Enum rustdoc::clean::types::PrimitiveType
source · 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 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 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<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<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 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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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.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> 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 moresource§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>
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