pub(crate) enum PrimitiveType {
Show 25 variants
Isize,
I8,
I16,
I32,
I64,
I128,
Usize,
U8,
U16,
U32,
U64,
U128,
F32,
F64,
Char,
Bool,
Str,
Slice,
Array,
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
F32
F64
Char
Bool
Str
Slice
Array
Tuple
Unit
RawPointer
Reference
Fn
Never
Implementations
sourceimpl 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 FxHashMap<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<'_>
) -> &FxHashMap<PrimitiveType, DefId>
pub(crate) fn primitive_locations(
tcx: TyCtxt<'_>
) -> &FxHashMap<PrimitiveType, DefId>
Returns the DefId of the module with 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 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
sourceimpl Clone for PrimitiveType
impl Clone for PrimitiveType
sourcefn clone(&self) -> PrimitiveType
fn clone(&self) -> PrimitiveType
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for PrimitiveType
impl Debug for PrimitiveType
sourceimpl From<FloatTy> for PrimitiveType
impl From<FloatTy> for PrimitiveType
sourcefn from(float_ty: FloatTy) -> PrimitiveType
fn from(float_ty: FloatTy) -> PrimitiveType
sourceimpl From<FloatTy> for PrimitiveType
impl From<FloatTy> for PrimitiveType
sourcefn from(float_ty: FloatTy) -> PrimitiveType
fn from(float_ty: FloatTy) -> PrimitiveType
sourceimpl From<IntTy> for PrimitiveType
impl From<IntTy> for PrimitiveType
sourcefn from(int_ty: IntTy) -> PrimitiveType
fn from(int_ty: IntTy) -> PrimitiveType
sourceimpl From<IntTy> for PrimitiveType
impl From<IntTy> for PrimitiveType
sourcefn from(int_ty: IntTy) -> PrimitiveType
fn from(int_ty: IntTy) -> PrimitiveType
sourceimpl From<PrimTy> for PrimitiveType
impl From<PrimTy> for PrimitiveType
sourcefn from(prim_ty: PrimTy) -> PrimitiveType
fn from(prim_ty: PrimTy) -> PrimitiveType
sourceimpl From<UintTy> for PrimitiveType
impl From<UintTy> for PrimitiveType
sourcefn from(uint_ty: UintTy) -> PrimitiveType
fn from(uint_ty: UintTy) -> PrimitiveType
sourceimpl From<UintTy> for PrimitiveType
impl From<UintTy> for PrimitiveType
sourcefn from(uint_ty: UintTy) -> PrimitiveType
fn from(uint_ty: UintTy) -> PrimitiveType
sourceimpl Hash for PrimitiveType
impl Hash for PrimitiveType
sourceimpl PartialEq<PrimitiveType> for PrimitiveType
impl PartialEq<PrimitiveType> for PrimitiveType
sourcefn eq(&self, other: &PrimitiveType) -> bool
fn eq(&self, other: &PrimitiveType) -> bool
impl Copy for PrimitiveType
impl Eq for PrimitiveType
impl StructuralEq for PrimitiveType
impl StructuralPartialEq for PrimitiveType
Auto Trait Implementations
impl RefUnwindSafe for PrimitiveType
impl Send for PrimitiveType
impl Sync for PrimitiveType
impl Unpin for PrimitiveType
impl UnwindSafe for PrimitiveType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn 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>,
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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 bytesF32
: 0 bytesF64
: 0 bytesChar
: 0 bytesBool
: 0 bytesStr
: 0 bytesSlice
: 0 bytesArray
: 0 bytesTuple
: 0 bytesUnit
: 0 bytesRawPointer
: 0 bytesReference
: 0 bytesFn
: 0 bytesNever
: 0 bytes