Use ExpandResult instead of MacroResult
`MacroResult` is redundant
This commit is contained in:
@@ -33,6 +33,7 @@ pub enum ExpandError {
|
||||
ConversionError,
|
||||
InvalidRepeat,
|
||||
ProcMacroError(tt::ExpansionError),
|
||||
Other(String),
|
||||
}
|
||||
|
||||
impl From<tt::ExpansionError> for ExpandError {
|
||||
@@ -264,6 +265,13 @@ impl<T> ExpandResult<T> {
|
||||
Self { value: Default::default(), err: Some(err) }
|
||||
}
|
||||
|
||||
pub fn str_err(err: String) -> Self
|
||||
where
|
||||
T: Default,
|
||||
{
|
||||
Self::only_err(ExpandError::Other(err))
|
||||
}
|
||||
|
||||
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> ExpandResult<U> {
|
||||
ExpandResult { value: f(self.value), err: self.err }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user