pub struct TokenOutputTrimmer<'t, 'o> {
preamble: Option<&'t dyn ToTokens>,
sep: &'t dyn ToTokens,
sep_count: usize,
out: &'o mut TokenStream,
}Expand description
For making an output TokenStream, but eliding an unnecessary tail
This construction will write, to an output TokenStream,
preamble- zero or more optional
impl ToTokens, called “reified” - interleaved with zero or more optional separators
sep
But it will avoid writing trailing unnecessary content:
that is, trailing calls to push_sep are ignored,
and if push_reified is never called,
the preamble is also omitted.
Fields§
§preamble: Option<&'t dyn ToTokens>§sep: &'t dyn ToTokens§sep_count: usize§out: &'o mut TokenStreamImplementations§
Source§impl<'t, 'o> TokenOutputTrimmer<'t, 'o>
impl<'t, 'o> TokenOutputTrimmer<'t, 'o>
Auto Trait Implementations§
impl<'t, 'o> Freeze for TokenOutputTrimmer<'t, 'o>
impl<'t, 'o> !RefUnwindSafe for TokenOutputTrimmer<'t, 'o>
impl<'t, 'o> !Send for TokenOutputTrimmer<'t, 'o>
impl<'t, 'o> !Sync for TokenOutputTrimmer<'t, 'o>
impl<'t, 'o> Unpin for TokenOutputTrimmer<'t, 'o>
impl<'t, 'o> !UnwindSafe for TokenOutputTrimmer<'t, 'o>
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