pub enum DeclarationGroup {
Type(GDeclarationGroup<TypeDeclId>),
Fun(GDeclarationGroup<FunDeclId>),
Global(GDeclarationGroup<GlobalDeclId>),
TraitDecl(GDeclarationGroup<TraitDeclId>),
TraitImpl(GDeclarationGroup<TraitImplId>),
Mixed(GDeclarationGroup<ItemId>),
}Expand description
A (group of) top-level declaration(s), properly reordered.
Variants§
Type(GDeclarationGroup<TypeDeclId>)
A type declaration group
Fun(GDeclarationGroup<FunDeclId>)
A function declaration group
Global(GDeclarationGroup<GlobalDeclId>)
A global declaration group
TraitDecl(GDeclarationGroup<TraitDeclId>)
TraitImpl(GDeclarationGroup<TraitImplId>)
Mixed(GDeclarationGroup<ItemId>)
Anything that doesn’t fit into these categories.
Implementations§
Source§impl DeclarationGroup
impl DeclarationGroup
Sourcepub fn is_type(&self) -> bool
pub fn is_type(&self) -> bool
Returns true if this is a DeclarationGroup::Type, otherwise false
Sourcepub fn as_type_mut(&mut self) -> Option<&mut GDeclarationGroup<TypeDeclId>>
pub fn as_type_mut(&mut self) -> Option<&mut GDeclarationGroup<TypeDeclId>>
Optionally returns mutable references to the inner fields if this is a DeclarationGroup::Type, otherwise None
Sourcepub fn as_type(&self) -> Option<&GDeclarationGroup<TypeDeclId>>
pub fn as_type(&self) -> Option<&GDeclarationGroup<TypeDeclId>>
Optionally returns references to the inner fields if this is a DeclarationGroup::Type, otherwise None
Sourcepub fn into_type(self) -> Result<GDeclarationGroup<TypeDeclId>, Self>
pub fn into_type(self) -> Result<GDeclarationGroup<TypeDeclId>, Self>
Returns the inner fields if this is a DeclarationGroup::Type, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_type_unchecked(self) -> GDeclarationGroup<TypeDeclId>
pub unsafe fn into_type_unchecked(self) -> GDeclarationGroup<TypeDeclId>
Unchecked return of the inner fields of DeclarationGroup::Type.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_type_unchecked(&self) -> &GDeclarationGroup<TypeDeclId>
pub unsafe fn as_type_unchecked(&self) -> &GDeclarationGroup<TypeDeclId>
Unchecked reference of the inner fields of DeclarationGroup::Type.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_type_mut_unchecked(
&mut self,
) -> &mut GDeclarationGroup<TypeDeclId>
pub unsafe fn as_type_mut_unchecked( &mut self, ) -> &mut GDeclarationGroup<TypeDeclId>
Unchecked mutable reference of the inner fields of DeclarationGroup::Type.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn as_fun_mut(&mut self) -> Option<&mut GDeclarationGroup<FunDeclId>>
pub fn as_fun_mut(&mut self) -> Option<&mut GDeclarationGroup<FunDeclId>>
Optionally returns mutable references to the inner fields if this is a DeclarationGroup::Fun, otherwise None
Sourcepub fn as_fun(&self) -> Option<&GDeclarationGroup<FunDeclId>>
pub fn as_fun(&self) -> Option<&GDeclarationGroup<FunDeclId>>
Optionally returns references to the inner fields if this is a DeclarationGroup::Fun, otherwise None
Sourcepub fn into_fun(self) -> Result<GDeclarationGroup<FunDeclId>, Self>
pub fn into_fun(self) -> Result<GDeclarationGroup<FunDeclId>, Self>
Returns the inner fields if this is a DeclarationGroup::Fun, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_fun_unchecked(self) -> GDeclarationGroup<FunDeclId>
pub unsafe fn into_fun_unchecked(self) -> GDeclarationGroup<FunDeclId>
Unchecked return of the inner fields of DeclarationGroup::Fun.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_fun_unchecked(&self) -> &GDeclarationGroup<FunDeclId>
pub unsafe fn as_fun_unchecked(&self) -> &GDeclarationGroup<FunDeclId>
Unchecked reference of the inner fields of DeclarationGroup::Fun.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_fun_mut_unchecked(
&mut self,
) -> &mut GDeclarationGroup<FunDeclId>
pub unsafe fn as_fun_mut_unchecked( &mut self, ) -> &mut GDeclarationGroup<FunDeclId>
Unchecked mutable reference of the inner fields of DeclarationGroup::Fun.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn is_global(&self) -> bool
pub fn is_global(&self) -> bool
Returns true if this is a DeclarationGroup::Global, otherwise false
Sourcepub fn as_global_mut(&mut self) -> Option<&mut GDeclarationGroup<GlobalDeclId>>
pub fn as_global_mut(&mut self) -> Option<&mut GDeclarationGroup<GlobalDeclId>>
Optionally returns mutable references to the inner fields if this is a DeclarationGroup::Global, otherwise None
Sourcepub fn as_global(&self) -> Option<&GDeclarationGroup<GlobalDeclId>>
pub fn as_global(&self) -> Option<&GDeclarationGroup<GlobalDeclId>>
Optionally returns references to the inner fields if this is a DeclarationGroup::Global, otherwise None
Sourcepub fn into_global(self) -> Result<GDeclarationGroup<GlobalDeclId>, Self>
pub fn into_global(self) -> Result<GDeclarationGroup<GlobalDeclId>, Self>
Returns the inner fields if this is a DeclarationGroup::Global, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_global_unchecked(self) -> GDeclarationGroup<GlobalDeclId>
pub unsafe fn into_global_unchecked(self) -> GDeclarationGroup<GlobalDeclId>
Unchecked return of the inner fields of DeclarationGroup::Global.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_global_unchecked(&self) -> &GDeclarationGroup<GlobalDeclId>
pub unsafe fn as_global_unchecked(&self) -> &GDeclarationGroup<GlobalDeclId>
Unchecked reference of the inner fields of DeclarationGroup::Global.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_global_mut_unchecked(
&mut self,
) -> &mut GDeclarationGroup<GlobalDeclId>
pub unsafe fn as_global_mut_unchecked( &mut self, ) -> &mut GDeclarationGroup<GlobalDeclId>
Unchecked mutable reference of the inner fields of DeclarationGroup::Global.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn is_trait_decl(&self) -> bool
pub fn is_trait_decl(&self) -> bool
Returns true if this is a DeclarationGroup::TraitDecl, otherwise false
Sourcepub fn as_trait_decl_mut(
&mut self,
) -> Option<&mut GDeclarationGroup<TraitDeclId>>
pub fn as_trait_decl_mut( &mut self, ) -> Option<&mut GDeclarationGroup<TraitDeclId>>
Optionally returns mutable references to the inner fields if this is a DeclarationGroup::TraitDecl, otherwise None
Sourcepub fn as_trait_decl(&self) -> Option<&GDeclarationGroup<TraitDeclId>>
pub fn as_trait_decl(&self) -> Option<&GDeclarationGroup<TraitDeclId>>
Optionally returns references to the inner fields if this is a DeclarationGroup::TraitDecl, otherwise None
Sourcepub fn into_trait_decl(self) -> Result<GDeclarationGroup<TraitDeclId>, Self>
pub fn into_trait_decl(self) -> Result<GDeclarationGroup<TraitDeclId>, Self>
Returns the inner fields if this is a DeclarationGroup::TraitDecl, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_trait_decl_unchecked(self) -> GDeclarationGroup<TraitDeclId>
pub unsafe fn into_trait_decl_unchecked(self) -> GDeclarationGroup<TraitDeclId>
Unchecked return of the inner fields of DeclarationGroup::TraitDecl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_trait_decl_unchecked(&self) -> &GDeclarationGroup<TraitDeclId>
pub unsafe fn as_trait_decl_unchecked(&self) -> &GDeclarationGroup<TraitDeclId>
Unchecked reference of the inner fields of DeclarationGroup::TraitDecl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_trait_decl_mut_unchecked(
&mut self,
) -> &mut GDeclarationGroup<TraitDeclId>
pub unsafe fn as_trait_decl_mut_unchecked( &mut self, ) -> &mut GDeclarationGroup<TraitDeclId>
Unchecked mutable reference of the inner fields of DeclarationGroup::TraitDecl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn is_trait_impl(&self) -> bool
pub fn is_trait_impl(&self) -> bool
Returns true if this is a DeclarationGroup::TraitImpl, otherwise false
Sourcepub fn as_trait_impl_mut(
&mut self,
) -> Option<&mut GDeclarationGroup<TraitImplId>>
pub fn as_trait_impl_mut( &mut self, ) -> Option<&mut GDeclarationGroup<TraitImplId>>
Optionally returns mutable references to the inner fields if this is a DeclarationGroup::TraitImpl, otherwise None
Sourcepub fn as_trait_impl(&self) -> Option<&GDeclarationGroup<TraitImplId>>
pub fn as_trait_impl(&self) -> Option<&GDeclarationGroup<TraitImplId>>
Optionally returns references to the inner fields if this is a DeclarationGroup::TraitImpl, otherwise None
Sourcepub fn into_trait_impl(self) -> Result<GDeclarationGroup<TraitImplId>, Self>
pub fn into_trait_impl(self) -> Result<GDeclarationGroup<TraitImplId>, Self>
Returns the inner fields if this is a DeclarationGroup::TraitImpl, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_trait_impl_unchecked(self) -> GDeclarationGroup<TraitImplId>
pub unsafe fn into_trait_impl_unchecked(self) -> GDeclarationGroup<TraitImplId>
Unchecked return of the inner fields of DeclarationGroup::TraitImpl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_trait_impl_unchecked(&self) -> &GDeclarationGroup<TraitImplId>
pub unsafe fn as_trait_impl_unchecked(&self) -> &GDeclarationGroup<TraitImplId>
Unchecked reference of the inner fields of DeclarationGroup::TraitImpl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_trait_impl_mut_unchecked(
&mut self,
) -> &mut GDeclarationGroup<TraitImplId>
pub unsafe fn as_trait_impl_mut_unchecked( &mut self, ) -> &mut GDeclarationGroup<TraitImplId>
Unchecked mutable reference of the inner fields of DeclarationGroup::TraitImpl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn is_mixed(&self) -> bool
pub fn is_mixed(&self) -> bool
Returns true if this is a DeclarationGroup::Mixed, otherwise false
Sourcepub fn as_mixed_mut(&mut self) -> Option<&mut GDeclarationGroup<ItemId>>
pub fn as_mixed_mut(&mut self) -> Option<&mut GDeclarationGroup<ItemId>>
Optionally returns mutable references to the inner fields if this is a DeclarationGroup::Mixed, otherwise None
Sourcepub fn as_mixed(&self) -> Option<&GDeclarationGroup<ItemId>>
pub fn as_mixed(&self) -> Option<&GDeclarationGroup<ItemId>>
Optionally returns references to the inner fields if this is a DeclarationGroup::Mixed, otherwise None
Sourcepub fn into_mixed(self) -> Result<GDeclarationGroup<ItemId>, Self>
pub fn into_mixed(self) -> Result<GDeclarationGroup<ItemId>, Self>
Returns the inner fields if this is a DeclarationGroup::Mixed, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_mixed_unchecked(self) -> GDeclarationGroup<ItemId>
pub unsafe fn into_mixed_unchecked(self) -> GDeclarationGroup<ItemId>
Unchecked return of the inner fields of DeclarationGroup::Mixed.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_mixed_unchecked(&self) -> &GDeclarationGroup<ItemId>
pub unsafe fn as_mixed_unchecked(&self) -> &GDeclarationGroup<ItemId>
Unchecked reference of the inner fields of DeclarationGroup::Mixed.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_mixed_mut_unchecked(
&mut self,
) -> &mut GDeclarationGroup<ItemId>
pub unsafe fn as_mixed_mut_unchecked( &mut self, ) -> &mut GDeclarationGroup<ItemId>
Unchecked mutable reference of the inner fields of DeclarationGroup::Mixed.
§Safety
Results in undefined behavior when it is the incorrect variant.
Source§impl DeclarationGroup
impl DeclarationGroup
fn make_group(is_rec: bool, ids: Vec<ItemId>) -> Self
pub fn to_mixed_group(&self) -> GDeclarationGroup<ItemId>
pub fn get_ids(&self) -> Vec<ItemId>
Trait Implementations§
Source§impl AstVisitable for DeclarationGroup
impl AstVisitable for DeclarationGroup
Source§fn drive<V: VisitAst>(&self, v: &mut V) -> ControlFlow<V::Break>
fn drive<V: VisitAst>(&self, v: &mut V) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner.Source§fn drive_mut<V: VisitAstMut>(&mut self, v: &mut V) -> ControlFlow<V::Break>
fn drive_mut<V: VisitAstMut>(&mut self, v: &mut V) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner.Source§fn drive_two<V: ZipAst>(&self, other: &Self, v: &mut V) -> ControlFlow<V::Break>
fn drive_two<V: ZipAst>(&self, other: &Self, v: &mut V) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner.Source§fn dyn_visit<T: AstVisitable>(&self, f: impl FnMut(&T))where
Self: Sized,
fn dyn_visit<T: AstVisitable>(&self, f: impl FnMut(&T))where
Self: Sized,
self, in pre-order traversal.Source§fn dyn_visit_mut<T: AstVisitable>(&mut self, f: impl FnMut(&mut T))where
Self: Sized,
fn dyn_visit_mut<T: AstVisitable>(&mut self, f: impl FnMut(&mut T))where
Self: Sized,
self, in pre-order traversal.Source§impl Clone for DeclarationGroup
impl Clone for DeclarationGroup
Source§fn clone(&self) -> DeclarationGroup
fn clone(&self) -> DeclarationGroup
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 DeclarationGroup
impl Debug for DeclarationGroup
Source§impl<'de> Deserialize<'de> for DeclarationGroup
impl<'de> Deserialize<'de> for DeclarationGroup
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 DeclarationGroup
impl Display for DeclarationGroup
Source§impl<C: AstFormatter> FmtWithCtx<C> for DeclarationGroup
impl<C: AstFormatter> FmtWithCtx<C> for DeclarationGroup
Auto Trait Implementations§
impl Freeze for DeclarationGroup
impl RefUnwindSafe for DeclarationGroup
impl Send for DeclarationGroup
impl Sync for DeclarationGroup
impl Unpin for DeclarationGroup
impl UnsafeUnpin for DeclarationGroup
impl UnwindSafe for DeclarationGroup
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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 moreimpl<T> Mappable for T
Source§impl<T> TyVisitable for Twhere
T: AstVisitable,
impl<T> TyVisitable for Twhere
T: AstVisitable,
Source§fn type_info(&self) -> TypeInfo
fn type_info(&self) -> TypeInfo
TypeInfo.Source§fn visit_vars(&mut self, v: &mut impl VarsVisitor)
fn visit_vars(&mut self, v: &mut impl VarsVisitor)
self, as seen from the outside of self. This means
that any variable bound inside self will be skipped, and all the seen De Bruijn indices
will count from the outside of self.Source§fn substitute(self, generics: &GenericArgs) -> Self
fn substitute(self, generics: &GenericArgs) -> Self
self by replacing them with the provided values.
Note: if self is an item that comes from a TraitDecl, you must use
substitute_with_self or substitute_inner_binder, otherwise you’ll get panics.Source§fn substitute_inner_binder(self, generics: &GenericArgs) -> Self
fn substitute_inner_binder(self, generics: &GenericArgs) -> Self
self by replacing them with the provided values.
This is appropriate when substituting an inner binder.Source§fn substitute_explicits(self, generics: &GenericArgs) -> Self
fn substitute_explicits(self, generics: &GenericArgs) -> Self
Source§fn substitute_with_self(
self,
generics: &GenericArgs,
self_ref: &TraitRefKind,
) -> Self
fn substitute_with_self( self, generics: &GenericArgs, self_ref: &TraitRefKind, ) -> Self
TraitRefKind::SelfId trait ref.Source§fn substitute_with_tref(self, tref: &TraitRef) -> Self
fn substitute_with_tref(self, tref: &TraitRef) -> Self
TraitRefKind::SelfId trait ref.Source§fn try_substitute_with_tref(
self,
tref: &TraitRef,
) -> Result<Self, GenericsMismatch>
fn try_substitute_with_tref( self, tref: &TraitRef, ) -> Result<Self, GenericsMismatch>
TraitRefKind::SelfId trait ref.fn try_substitute( self, generics: &GenericArgs, ) -> Result<Self, GenericsMismatch>
fn try_substitute_with_self( self, generics: &GenericArgs, self_ref: &TraitRefKind, ) -> Result<Self, GenericsMismatch>
Source§fn move_under_binder(self) -> Self
fn move_under_binder(self) -> Self
Source§fn move_under_binders(self, depth: DeBruijnId) -> Self
fn move_under_binders(self, depth: DeBruijnId) -> Self
depth binders.Source§fn move_from_under_binder(self) -> Option<Self>
fn move_from_under_binder(self) -> Option<Self>
Source§fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>
fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>
depth binders. Returns None if it contains a variable bound in
one of these depth binders.Source§fn visit_db_id<B>(
&mut self,
f: impl FnMut(&mut DeBruijnId) -> ControlFlow<B>,
) -> ControlFlow<B>
fn visit_db_id<B>( &mut self, f: impl FnMut(&mut DeBruijnId) -> ControlFlow<B>, ) -> ControlFlow<B>
self, as seen from the outside of self. This means
that any variable bound inside self will be skipped, and all the seen indices will count
from the outside of self.Source§fn has_escaping_region_var(&self) -> bool
fn has_escaping_region_var(&self) -> bool
Source§fn collect_regions(&self) -> SeqHashSet<Region>
fn collect_regions(&self) -> SeqHashSet<Region>
self.