pub struct Parentheses<T = TokenStream> {
pub span: DelimSpan,
pub contents: T,
}Expand description
( T )
Fields§
§span: DelimSpan§contents: TImplementations§
Source§impl<T> Parentheses<T>
impl<T> Parentheses<T>
Sourcepub fn map<U>(self, f: impl FnOnce(T) -> U) -> Parentheses<U>
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> Parentheses<U>
Maps self.contents using f.
Sourcepub fn try_map<U, E>(
self,
f: impl FnOnce(T) -> Result<U, E>,
) -> Result<Parentheses<U>, Parentheses<E>>
pub fn try_map<U, E>( self, f: impl FnOnce(T) -> Result<U, E>, ) -> Result<Parentheses<U>, Parentheses<E>>
Tries to map self.contents using f.
Source§impl<T, E> Parentheses<Result<T, E>>
impl<T, E> Parentheses<Result<T, E>>
Sourcepub fn transpose(self) -> Result<Parentheses<T>, Parentheses<E>>
pub fn transpose(self) -> Result<Parentheses<T>, Parentheses<E>>
Lifts an inner Result out of self. (The Parentheses “sinks” into the variants.)
Trait Implementations§
Source§impl<T: Clone> Clone for Parentheses<T>
impl<T: Clone> Clone for Parentheses<T>
Source§fn clone(&self) -> Parentheses<T>
fn clone(&self) -> Parentheses<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: IntoTokens> IntoTokens for Parentheses<T>
impl<T: IntoTokens> IntoTokens for Parentheses<T>
Source§fn into_tokens(self, root: &TokenStream, tokens: &mut impl Extend<TokenTree>)
fn into_tokens(self, root: &TokenStream, tokens: &mut impl Extend<TokenTree>)
Source§fn collect_tokens<T>(self, root: &TokenStream) -> T
fn collect_tokens<T>(self, root: &TokenStream) -> T
Convenience methods to emit
self’s tokens into a new T.Source§impl<T: PeekFrom> PeekFrom for Parentheses<T>
Checks for the delimiters and contents.
impl<T: PeekFrom> PeekFrom for Parentheses<T>
Checks for the delimiters and contents.
Auto Trait Implementations§
impl<T> Freeze for Parentheses<T>where
T: Freeze,
impl<T> RefUnwindSafe for Parentheses<T>where
T: RefUnwindSafe,
impl<T = TokenStream> !Send for Parentheses<T>
impl<T = TokenStream> !Sync for Parentheses<T>
impl<T> Unpin for Parentheses<T>where
T: Unpin,
impl<T> UnwindSafe for Parentheses<T>where
T: 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