pub(crate) enum PrimitiveType {
Show 28 variants
Isize,
I8,
I16,
I32,
I64,
I128,
Usize,
U8,
U16,
U32,
U64,
U128,
F16,
F32,
F64,
F128,
Char,
Bool,
Str,
Slice,
Array,
Pat,
Tuple,
Unit,
RawPointer,
Reference,
Fn,
Never,
}Expand description
A primitive (aka, builtin) type.
This represents things like i32, str, etc.
N.B. This has to be different from hir::PrimTy because it also includes types that aren’t
paths, like Self::Unit.
Variants§
Isize
I8
I16
I32
I64
I128
Usize
U8
U16
U32
U64
U128
F16
F32
F64
F128
Char
Bool
Str
Slice
Array
Pat
Tuple
Unit
RawPointer
Reference
Fn
Never
Implementations§
Source§impl PrimitiveType
impl PrimitiveType
pub(crate) fn from_hir(prim: PrimTy) -> PrimitiveType
pub(crate) fn from_symbol(s: Symbol) -> Option<PrimitiveType>
pub(crate) fn simplified_types() -> &'static FxIndexMap<PrimitiveType, ArrayVec<SimplifiedType, 3>>
pub(crate) fn impls<'tcx>( &self, tcx: TyCtxt<'tcx>, ) -> impl Iterator<Item = DefId> + 'tcx
pub(crate) fn all_impls(tcx: TyCtxt<'_>) -> impl Iterator<Item = DefId>
pub(crate) fn as_sym(&self) -> Symbol
Sourcepub(crate) fn primitive_locations(
tcx: TyCtxt<'_>,
) -> &FxIndexMap<PrimitiveType, DefId>
pub(crate) fn primitive_locations( tcx: TyCtxt<'_>, ) -> &FxIndexMap<PrimitiveType, DefId>
Returns the DefId of the module with rustc_doc_primitive for this primitive type.
Panics if there is no such module.
This gives precedence to primitives defined in the current crate, and deprioritizes
primitives defined in core,
but otherwise, if multiple crates define the same primitive, there is no guarantee of which
will be picked.
In particular, if a crate depends on both std and another crate that also defines
rustc_doc_primitive, then it’s entirely random whether std or the other crate is picked.
(no_std crates are usually fine unless multiple dependencies define a primitive.)
Trait Implementations§
Source§impl Clone for PrimitiveType
impl Clone for PrimitiveType
Source§fn clone(&self) -> PrimitiveType
fn clone(&self) -> PrimitiveType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PrimitiveType
impl Debug for PrimitiveType
Source§impl From<FloatTy> for PrimitiveType
impl From<FloatTy> for PrimitiveType
Source§fn from(float_ty: FloatTy) -> PrimitiveType
fn from(float_ty: FloatTy) -> PrimitiveType
Source§impl From<IntTy> for PrimitiveType
impl From<IntTy> for PrimitiveType
Source§fn from(int_ty: IntTy) -> PrimitiveType
fn from(int_ty: IntTy) -> PrimitiveType
Source§impl From<PrimTy> for PrimitiveType
impl From<PrimTy> for PrimitiveType
Source§fn from(prim_ty: PrimTy) -> PrimitiveType
fn from(prim_ty: PrimTy) -> PrimitiveType
Source§impl From<UintTy> for PrimitiveType
impl From<UintTy> for PrimitiveType
Source§fn from(uint_ty: UintTy) -> PrimitiveType
fn from(uint_ty: UintTy) -> PrimitiveType
Source§impl Hash for PrimitiveType
impl Hash for PrimitiveType
Source§impl PartialEq for PrimitiveType
impl PartialEq for PrimitiveType
impl Copy for PrimitiveType
impl Eq for PrimitiveType
impl StructuralPartialEq for PrimitiveType
Auto Trait Implementations§
impl Freeze for PrimitiveType
impl RefUnwindSafe for PrimitiveType
impl Send for PrimitiveType
impl Sync for PrimitiveType
impl Unpin for PrimitiveType
impl UnwindSafe for PrimitiveType
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<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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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:
Isize: 0 bytesI8: 0 bytesI16: 0 bytesI32: 0 bytesI64: 0 bytesI128: 0 bytesUsize: 0 bytesU8: 0 bytesU16: 0 bytesU32: 0 bytesU64: 0 bytesU128: 0 bytesF16: 0 bytesF32: 0 bytesF64: 0 bytesF128: 0 bytesChar: 0 bytesBool: 0 bytesStr: 0 bytesSlice: 0 bytesArray: 0 bytesPat: 0 bytesTuple: 0 bytesUnit: 0 bytesRawPointer: 0 bytesReference: 0 bytesFn: 0 bytesNever: 0 bytes