#[repr(u8)]pub(crate) enum ItemType {
Show 26 variants
Keyword = 0,
Primitive = 1,
Module = 2,
ExternCrate = 3,
Import = 4,
Struct = 5,
Enum = 6,
Function = 7,
TypeAlias = 8,
Static = 9,
Trait = 10,
Impl = 11,
TyMethod = 12,
Method = 13,
StructField = 14,
Variant = 15,
Macro = 16,
AssocType = 17,
Constant = 18,
AssocConst = 19,
Union = 20,
ForeignType = 21,
OpaqueTy = 22,
ProcAttribute = 23,
ProcDerive = 24,
TraitAlias = 25,
}
Expand description
Item type. Corresponds to clean::ItemEnum
variants.
The search index uses item types encoded as smaller numbers which equal to
discriminants. JavaScript then is used to decode them into the original value.
Consequently, every change to this type should be synchronized to
the itemTypes
mapping table in html/static/js/search.js
.
The search engine in search.js also uses item type numbers as a tie breaker when sorting results. Keywords and primitives are given first because we want them to be easily found by new users who don’t know about advanced features like type filters. The rest are mostly in an arbitrary order, but it’s easier to test the search engine when it’s deterministic, and these are strictly finer-grained than language namespaces, so using the path and the item type together to sort ensures that search sorting is stable.
In addition, code in html::render
uses this enum to generate CSS classes, page prefixes, and
module headings. If you are adding to this enum and want to ensure that the sidebar also prints
a heading, edit the listing in html/render.rs
, function sidebar_module
. This uses an
ordering based on a helper function inside item_module
, in the same file.
Variants§
Keyword = 0
Primitive = 1
Module = 2
ExternCrate = 3
Import = 4
Struct = 5
Enum = 6
Function = 7
TypeAlias = 8
Static = 9
Trait = 10
Impl = 11
TyMethod = 12
Method = 13
StructField = 14
Variant = 15
Macro = 16
AssocType = 17
Constant = 18
AssocConst = 19
Union = 20
ForeignType = 21
OpaqueTy = 22
ProcAttribute = 23
ProcDerive = 24
TraitAlias = 25
Implementations§
source§impl ItemType
impl ItemType
sourcepub(crate) fn from_def_kind(kind: DefKind, parent_kind: Option<DefKind>) -> Self
pub(crate) fn from_def_kind(kind: DefKind, parent_kind: Option<DefKind>) -> Self
Depending on the parent kind, some variants have a different translation (like a Method
becoming a TyMethod
).
pub(crate) fn as_str(&self) -> &'static str
pub(crate) fn is_method(&self) -> bool
pub(crate) fn is_adt(&self) -> bool
Trait Implementations§
source§impl FromWithTcx<ItemType> for ItemKind
impl FromWithTcx<ItemType> for ItemKind
source§impl Ord for ItemType
impl Ord for ItemType
source§impl PartialEq for ItemType
impl PartialEq for ItemType
source§impl PartialOrd for ItemType
impl PartialOrd for ItemType
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for ItemType
impl Eq for ItemType
impl StructuralPartialEq for ItemType
Auto Trait Implementations§
impl DynSend for ItemType
impl DynSync for ItemType
impl Freeze for ItemType
impl RefUnwindSafe for ItemType
impl Send for ItemType
impl Sync for ItemType
impl Unpin for ItemType
impl UnwindSafe for ItemType
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter<'a>( arena: &'a Arena<'tcx>, iter: impl IntoIterator<Item = T> ) -> &'a mut [T]
source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter<'a>( arena: &'a Arena<'tcx>, iter: impl IntoIterator<Item = T> ) -> &'a mut [T]
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, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§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<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> Filterable for T
impl<T> Filterable for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> CodegenObject for T
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
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: 1 byte
Size for each variant:
Keyword
: 0 bytesPrimitive
: 0 bytesModule
: 0 bytesExternCrate
: 0 bytesImport
: 0 bytesStruct
: 0 bytesEnum
: 0 bytesFunction
: 0 bytesTypeAlias
: 0 bytesStatic
: 0 bytesTrait
: 0 bytesImpl
: 0 bytesTyMethod
: 0 bytesMethod
: 0 bytesStructField
: 0 bytesVariant
: 0 bytesMacro
: 0 bytesAssocType
: 0 bytesConstant
: 0 bytesAssocConst
: 0 bytesUnion
: 0 bytesForeignType
: 0 bytesOpaqueTy
: 0 bytesProcAttribute
: 0 bytesProcDerive
: 0 bytesTraitAlias
: 0 bytes