Struct Lifetime

pub struct Lifetime { pub apostrophe: Span, pub ident: Ident }

A Rust lifetime: 'a.

Lifetime names must conform to the following rules:

Fields

apostrophe: Span
ident: Ident

Implementations

impl Lifetime

fn new(symbol: &str, span: Span) -> Self

Panics

Panics if the lifetime does not conform to the bulleted rules above.

Invocation

# use proc_macro2::Span;
# use syn::Lifetime;
#
# fn f() -> Lifetime {
Lifetime::new("'a", Span::call_site())
# }
fn span(&self) -> Span
fn set_span(&mut self, span: Span)
fn parse_any(input: ParseStream<'_>) -> Result<Self>

Trait Implementations

impl Clone for Lifetime

fn clone(&self) -> Self

impl Display for Lifetime

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

impl Eq for Lifetime

impl Hash for Lifetime

fn hash<H: Hasher>(&self, h: &mut H)

impl Ord for Lifetime

fn cmp(&self, other: &Lifetime) -> Ordering

impl Parse for Lifetime

fn parse(input: ParseStream<'_>) -> Result<Self>

impl PartialEq for Lifetime

fn eq(&self, other: &Lifetime) -> bool

impl PartialOrd for Lifetime

fn partial_cmp(&self, other: &Lifetime) -> Option<Ordering>

impl ToTokens for Lifetime

fn to_tokens(&self, tokens: &mut TokenStream)

impl Token for Lifetime

Auto Trait Implementations

impl !Send for Lifetime

impl !Sync for Lifetime

impl Freeze for Lifetime

impl RefUnwindSafe for Lifetime

impl Unpin for Lifetime

impl UnsafeUnpin for Lifetime

impl UnwindSafe for Lifetime

Blanket Implementations

impl<T> Any for Lifetime where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Lifetime where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Lifetime where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for Lifetime where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Lifetime

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Spanned for Lifetime where T: Spanned + ?Sized,

fn span(&self) -> Span

impl<T> ToOwned for Lifetime where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> ToString for Lifetime where T: Display + ?Sized,

fn to_string(&self) -> String

impl<T, U> Into<U> for Lifetime where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Lifetime where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Lifetime where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>