#[non_exhaustive]pub enum Lifetime {
Static,
Named(NamedLifetime),
Anonymous,
}
Expand description
A lifetime, analogous to [syn::Lifetime
].
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Static
The 'static
lifetime.
Named(NamedLifetime)
A named lifetime, like 'a
.
Anonymous
An elided lifetime.
Implementations§
source§impl Lifetime
impl Lifetime
sourcepub fn to_named(self) -> Option<NamedLifetime>
pub fn to_named(self) -> Option<NamedLifetime>
Returns the inner NamedLifetime
if the lifetime is the Named
variant,
otherwise None
.
sourcepub fn as_named(&self) -> Option<&NamedLifetime>
pub fn as_named(&self) -> Option<&NamedLifetime>
Returns a reference to the inner NamedLifetime
if the lifetime is the
Named
variant, otherwise None
.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Lifetime
impl<'de> Deserialize<'de> for Lifetime
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl ToTokens for Lifetime
impl ToTokens for Lifetime
source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl Eq for Lifetime
impl StructuralPartialEq for Lifetime
Auto Trait Implementations§
impl Freeze for Lifetime
impl RefUnwindSafe for Lifetime
impl Send for Lifetime
impl Sync for Lifetime
impl Unpin for Lifetime
impl UnwindSafe for Lifetime
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Spanned for T
impl<T> Spanned for T
source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.