pub struct SubstIf<O: SubstParseContext> {
pub tests: Vec<(Subst<BooleanContext>, Template<O>)>,
pub otherwise: Option<Box<Template<O>>>,
pub kw_span: Span,
}Fields§
§tests: Vec<(Subst<BooleanContext>, Template<O>)>A series of test/result pairs.
The test that gives “true” short-circuits the rest.
otherwise: Option<Box<Template<O>>>A final element to expand if all tests fail.
kw_span: SpanImplementations§
Source§impl<O> SubstIf<O>
impl<O> SubstIf<O>
fn expand_select1<'c>(&self, ctx: GeneralContext<'c>, out: &mut O) -> Result<()>
Source§impl<O: SubstParseContext> SubstIf<O>
impl<O: SubstParseContext> SubstIf<O>
fn parse(input: ParseStream<'_>, kw_span: Span) -> Result<Self>
Trait Implementations§
Source§impl<O: SubstParseContext> AnalyseRepeat for SubstIf<O>
impl<O: SubstParseContext> AnalyseRepeat for SubstIf<O>
fn analyse_repeat(&self, visitor: &mut RepeatAnalysisVisitor) -> Result<()>
Source§impl<O: SubstParseContext> FindRecogMetas for SubstIf<O>
impl<O: SubstParseContext> FindRecogMetas for SubstIf<O>
Source§fn find_recog_metas(&self, acc: &mut Recognised)
fn find_recog_metas(&self, acc: &mut Recognised)
Search for
fmeta(..) etc. expansions Read moreAuto Trait Implementations§
impl<O> Freeze for SubstIf<O>
impl<O> RefUnwindSafe for SubstIf<O>where
<O as SubstParseContext>::NotInConcat: RefUnwindSafe,
<O as SubstParseContext>::NotInPaste: RefUnwindSafe,
<O as SubstParseContext>::NotInBool: RefUnwindSafe,
<O as SubstParseContext>::BoolOnly: RefUnwindSafe,
<O as SubstParseContext>::DbgContent: RefUnwindSafe,
impl<O> !Send for SubstIf<O>
impl<O> !Sync for SubstIf<O>
impl<O> Unpin for SubstIf<O>where
<O as SubstParseContext>::NotInConcat: Unpin,
<O as SubstParseContext>::NotInPaste: Unpin,
<O as SubstParseContext>::NotInBool: Unpin,
<O as SubstParseContext>::BoolOnly: Unpin,
impl<O> UnwindSafe for SubstIf<O>where
<O as SubstParseContext>::NotInConcat: UnwindSafe,
<O as SubstParseContext>::NotInPaste: UnwindSafe,
<O as SubstParseContext>::NotInBool: UnwindSafe,
<O as SubstParseContext>::BoolOnly: UnwindSafe,
<O as SubstParseContext>::DbgContent: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more