pub enum GenericsSource {
Item(ItemId),
Method(TraitDeclId, TraitMethodId),
TraitType(TraitDeclId, AssocTypeId),
Builtin,
Other,
}Expand description
Each GenericArgs is meant for a corresponding GenericParams; this describes which one.
Variants§
Item(ItemId)
A top-level item.
Method(TraitDeclId, TraitMethodId)
A trait method.
TraitType(TraitDeclId, AssocTypeId)
A trait associated type.
Builtin
A builtin item like Box.
Other
Some other use of generics outside the main Charon ast.
Implementations§
Source§impl GenericsSource
impl GenericsSource
Sourcepub fn as_item_mut(&mut self) -> Option<&mut ItemId>
pub fn as_item_mut(&mut self) -> Option<&mut ItemId>
Optionally returns mutable references to the inner fields if this is a GenericsSource::Item, otherwise None
Sourcepub fn as_item(&self) -> Option<&ItemId>
pub fn as_item(&self) -> Option<&ItemId>
Optionally returns references to the inner fields if this is a GenericsSource::Item, otherwise None
Sourcepub fn into_item(self) -> Result<ItemId, Self>
pub fn into_item(self) -> Result<ItemId, Self>
Returns the inner fields if this is a GenericsSource::Item, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_item_unchecked(self) -> ItemId
pub unsafe fn into_item_unchecked(self) -> ItemId
Unchecked return of the inner fields of GenericsSource::Item.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_item_unchecked(&self) -> &ItemId
pub unsafe fn as_item_unchecked(&self) -> &ItemId
Unchecked reference of the inner fields of GenericsSource::Item.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_item_mut_unchecked(&mut self) -> &mut ItemId
pub unsafe fn as_item_mut_unchecked(&mut self) -> &mut ItemId
Unchecked mutable reference of the inner fields of GenericsSource::Item.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn is_method(&self) -> bool
pub fn is_method(&self) -> bool
Returns true if this is a GenericsSource::Method, otherwise false
Sourcepub fn as_method_mut(
&mut self,
) -> Option<(&mut TraitDeclId, &mut TraitMethodId)>
pub fn as_method_mut( &mut self, ) -> Option<(&mut TraitDeclId, &mut TraitMethodId)>
Optionally returns mutable references to the inner fields if this is a GenericsSource::Method, otherwise None
Sourcepub fn as_method(&self) -> Option<(&TraitDeclId, &TraitMethodId)>
pub fn as_method(&self) -> Option<(&TraitDeclId, &TraitMethodId)>
Optionally returns references to the inner fields if this is a GenericsSource::Method, otherwise None
Sourcepub fn into_method(self) -> Result<(TraitDeclId, TraitMethodId), Self>
pub fn into_method(self) -> Result<(TraitDeclId, TraitMethodId), Self>
Returns the inner fields if this is a GenericsSource::Method, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_method_unchecked(self) -> (TraitDeclId, TraitMethodId)
pub unsafe fn into_method_unchecked(self) -> (TraitDeclId, TraitMethodId)
Unchecked return of the inner fields of GenericsSource::Method.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_method_unchecked(&self) -> (&TraitDeclId, &TraitMethodId)
pub unsafe fn as_method_unchecked(&self) -> (&TraitDeclId, &TraitMethodId)
Unchecked reference of the inner fields of GenericsSource::Method.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_method_mut_unchecked(
&mut self,
) -> (&mut TraitDeclId, &mut TraitMethodId)
pub unsafe fn as_method_mut_unchecked( &mut self, ) -> (&mut TraitDeclId, &mut TraitMethodId)
Unchecked mutable reference of the inner fields of GenericsSource::Method.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn is_trait_type(&self) -> bool
pub fn is_trait_type(&self) -> bool
Returns true if this is a GenericsSource::TraitType, otherwise false
Sourcepub fn as_trait_type_mut(
&mut self,
) -> Option<(&mut TraitDeclId, &mut AssocTypeId)>
pub fn as_trait_type_mut( &mut self, ) -> Option<(&mut TraitDeclId, &mut AssocTypeId)>
Optionally returns mutable references to the inner fields if this is a GenericsSource::TraitType, otherwise None
Sourcepub fn as_trait_type(&self) -> Option<(&TraitDeclId, &AssocTypeId)>
pub fn as_trait_type(&self) -> Option<(&TraitDeclId, &AssocTypeId)>
Optionally returns references to the inner fields if this is a GenericsSource::TraitType, otherwise None
Sourcepub fn into_trait_type(self) -> Result<(TraitDeclId, AssocTypeId), Self>
pub fn into_trait_type(self) -> Result<(TraitDeclId, AssocTypeId), Self>
Returns the inner fields if this is a GenericsSource::TraitType, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_trait_type_unchecked(self) -> (TraitDeclId, AssocTypeId)
pub unsafe fn into_trait_type_unchecked(self) -> (TraitDeclId, AssocTypeId)
Unchecked return of the inner fields of GenericsSource::TraitType.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_trait_type_unchecked(&self) -> (&TraitDeclId, &AssocTypeId)
pub unsafe fn as_trait_type_unchecked(&self) -> (&TraitDeclId, &AssocTypeId)
Unchecked reference of the inner fields of GenericsSource::TraitType.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_trait_type_mut_unchecked(
&mut self,
) -> (&mut TraitDeclId, &mut AssocTypeId)
pub unsafe fn as_trait_type_mut_unchecked( &mut self, ) -> (&mut TraitDeclId, &mut AssocTypeId)
Unchecked mutable reference of the inner fields of GenericsSource::TraitType.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn is_builtin(&self) -> bool
pub fn is_builtin(&self) -> bool
Returns true if this is a GenericsSource::Builtin, otherwise false
Trait Implementations§
Source§impl Clone for GenericsSource
impl Clone for GenericsSource
Source§fn clone(&self) -> GenericsSource
fn clone(&self) -> GenericsSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GenericsSource
impl Debug for GenericsSource
Source§impl<'s, V> Drive<'s, V> for GenericsSourcewhere
V: Visitor + Visit<'s, ItemId> + Visit<'s, TraitDeclId> + Visit<'s, TraitMethodId> + Visit<'s, AssocTypeId>,
impl<'s, V> Drive<'s, V> for GenericsSourcewhere
V: Visitor + Visit<'s, ItemId> + Visit<'s, TraitDeclId> + Visit<'s, TraitMethodId> + Visit<'s, AssocTypeId>,
Source§fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
v.visit() on the immediate contents of self.Source§impl<'s, V> DriveMut<'s, V> for GenericsSourcewhere
V: Visitor + VisitMut<'s, ItemId> + VisitMut<'s, TraitDeclId> + VisitMut<'s, TraitMethodId> + VisitMut<'s, AssocTypeId>,
impl<'s, V> DriveMut<'s, V> for GenericsSourcewhere
V: Visitor + VisitMut<'s, ItemId> + VisitMut<'s, TraitDeclId> + VisitMut<'s, TraitMethodId> + VisitMut<'s, AssocTypeId>,
Source§fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
v.visit() on the immediate contents of self.impl Eq for GenericsSource
Source§impl<C: AstFormatter> FmtWithCtx<C> for GenericsSource
impl<C: AstFormatter> FmtWithCtx<C> for GenericsSource
Source§impl Hash for GenericsSource
impl Hash for GenericsSource
Source§impl PartialEq for GenericsSource
impl PartialEq for GenericsSource
impl StructuralPartialEq for GenericsSource
Auto Trait Implementations§
impl Freeze for GenericsSource
impl RefUnwindSafe for GenericsSource
impl Send for GenericsSource
impl Sync for GenericsSource
impl Unpin for GenericsSource
impl UnsafeUnpin for GenericsSource
impl UnwindSafe for GenericsSource
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,
impl<T> Dedup for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> HashConsable for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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