Enum rustc_const_eval::interpret::ConstValue  [−][src]
pub enum ConstValue<'tcx> {
    Scalar(Scalar<AllocId>),
    Slice {
        data: &'tcx Allocation<AllocId, ()>,
        start: usize,
        end: usize,
    },
    ByRef {
        alloc: &'tcx Allocation<AllocId, ()>,
        offset: Size,
    },
}Expand description
Represents a constant value in Rust. Scalar and Slice are optimizations for
array length computations, enum discriminants and the pattern matching logic.
Variants
Used only for types with layout::abi::Scalar ABI and ZSTs.
Not using the enum Value to encode that this must not be Uninit.
Used only for &[u8] and &str
Fields of Slice
A value not represented/representable by Scalar or Slice
Fields of ByRef
alloc: &'tcx Allocation<AllocId, ()>The backing memory of the value, may contain more memory than needed for just the value
in order to share Allocations between values
offset: SizeOffset into alloc
Auto Trait Implementations
impl<'tcx> RefUnwindSafe for ConstValue<'tcx>
impl<'tcx> Send for ConstValue<'tcx>
impl<'tcx> Sync for ConstValue<'tcx>
impl<'tcx> Unpin for ConstValue<'tcx>
impl<'tcx> UnwindSafe for ConstValue<'tcx>
Blanket Implementations
Mutably borrows from an owned value. Read more
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: 32 bytes
Size for each variant:
- Scalar: 24 bytes
- Slice: 24 bytes
- ByRef: 16 bytes