pub struct LifetimeEnv { /* private fields */ }Expand description
A lifetime dependency graph used for tracking which lifetimes outlive, and are outlived by, other lifetimes.
It is similar to [syn::LifetimeDef], except it can also track lifetime
bounds defined in the where clause.
Implementations§
Source§impl LifetimeEnv
impl LifetimeEnv
Sourcepub fn names(&self) -> impl Iterator<Item = &NamedLifetime> + Clone
pub fn names(&self) -> impl Iterator<Item = &NamedLifetime> + Clone
Iterate through the names of the lifetimes in scope.
Sourcepub fn from_method_item(
method: &ImplItemFn,
impl_generics: Option<&Generics>,
self_param: Option<&SelfParam>,
params: &[Param],
return_type: Option<&TypeName>,
) -> Self
pub fn from_method_item( method: &ImplItemFn, impl_generics: Option<&Generics>, self_param: Option<&SelfParam>, params: &[Param], return_type: Option<&TypeName>, ) -> Self
Returns a LifetimeEnv for a method, accounting for lifetimes and bounds
defined in both the impl block and the method, as well as implicit lifetime
bounds in the optional self param, other param, and optional return type.
For example, the type &'a Foo<'b> implies 'b: 'a.
Sourcepub fn from_struct_item(
strct: &ItemStruct,
fields: &[(Ident, TypeName, Docs)],
) -> Self
pub fn from_struct_item( strct: &ItemStruct, fields: &[(Ident, TypeName, Docs)], ) -> Self
Returns a LifetimeEnv for a struct, accounding for lifetimes and bounds
defined in the struct generics, as well as implicit lifetime bounds in
the struct’s fields. For example, the field &'a Foo<'b> implies 'b: 'a.
Sourcepub fn lifetimes_to_tokens(&self) -> TokenStream
pub fn lifetimes_to_tokens(&self) -> TokenStream
<'a, 'b, 'c>
Write the existing lifetimes, excluding bounds, as generic parameters.
To include lifetime bounds, use [LifetimeEnv::lifetime_defs_to_tokens].
Trait Implementations§
Source§impl Clone for LifetimeEnv
impl Clone for LifetimeEnv
Source§fn clone(&self) -> LifetimeEnv
fn clone(&self) -> LifetimeEnv
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LifetimeEnv
impl Debug for LifetimeEnv
Source§impl<'de> Deserialize<'de> for LifetimeEnv
impl<'de> Deserialize<'de> for LifetimeEnv
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>,
Source§impl Display for LifetimeEnv
impl Display for LifetimeEnv
Source§impl Hash for LifetimeEnv
impl Hash for LifetimeEnv
Source§impl PartialEq for LifetimeEnv
impl PartialEq for LifetimeEnv
Source§impl Serialize for LifetimeEnv
Serialize a LifetimeEnv as a map from lifetimes to their bounds.
impl Serialize for LifetimeEnv
Serialize a LifetimeEnv as a map from lifetimes to their bounds.
Source§impl ToTokens for LifetimeEnv
impl ToTokens for LifetimeEnv
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 LifetimeEnv
impl StructuralPartialEq for LifetimeEnv
Auto Trait Implementations§
impl Freeze for LifetimeEnv
impl RefUnwindSafe for LifetimeEnv
impl Send for LifetimeEnv
impl Sync for LifetimeEnv
impl Unpin for LifetimeEnv
impl UnwindSafe for LifetimeEnv
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes