pub enum ItemClass {
Fn,
Record,
Sum,
Class,
Interface,
Alias,
AssocType,
Const,
Global,
Module,
Import,
}Expand description
The kinds of named items a policy distinguishes.
§Examples
use resolve_lang::ItemClass;
assert_eq!(ItemClass::ALL.len(), 11);Variants§
Fn
A function or method.
Record
A record (struct).
Sum
A sum (enum).
Class
A class (or PHP trait, a mixin class).
Interface
An interface or trait.
Alias
A type alias.
AssocType
An associated type.
Const
A constant.
Global
A global variable (a static, a Python module-level variable).
Module
A module.
Import
An import (use, import, from … import).
Implementations§
Source§impl ItemClass
impl ItemClass
Sourcepub const ALL: [Self; 11]
pub const ALL: [Self; 11]
Every item class.
§Examples
use resolve_lang::ItemClass;
assert_eq!(ItemClass::ALL[0], ItemClass::Fn);Sourcepub const fn of(kind: &ItemKind) -> Option<Self>
pub const fn of(kind: &ItemKind) -> Option<Self>
The class of a HIR item kind, or None for kinds that bind no name
(impl, mixin use, error items).
§Examples
use hir_lang::{FnDef, ItemKind};
use resolve_lang::ItemClass;
assert_eq!(ItemClass::of(&ItemKind::Fn(FnDef::default())), Some(ItemClass::Fn));
assert_eq!(ItemClass::of(&ItemKind::Err), None);Trait Implementations§
impl Copy for ItemClass
impl Eq for ItemClass
Source§impl Ord for ItemClass
impl Ord for ItemClass
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for ItemClass
impl PartialOrd for ItemClass
impl StructuralPartialEq for ItemClass
Auto Trait Implementations§
impl Freeze for ItemClass
impl RefUnwindSafe for ItemClass
impl Send for ItemClass
impl Sync for ItemClass
impl Unpin for ItemClass
impl UnsafeUnpin for ItemClass
impl UnwindSafe for ItemClass
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