pub enum Scalar<Prov = AllocId> {
Int(ScalarInt),
Ptr(Pointer<Prov>, u8),
}
Expand description
A Scalar
represents an immediate, primitive value existing outside of a
memory::Allocation
. It is in many ways like a small chunk of an Allocation
, up to 16 bytes in
size. Like a range of bytes in an Allocation
, a Scalar
can either represent the raw bytes
of a simple value or a pointer into another Allocation
These variants would be private if there was a convenient way to achieve that in Rust.
Do not match on a Scalar
! Use the various to_*
methods instead.
Variants§
Int(ScalarInt)
The raw bytes of a simple value.
Ptr(Pointer<Prov>, u8)
A pointer.
We also store the size of the pointer, such that a Scalar
always knows how big it is.
The size is always the pointer size of the current target, but this is not information
that we always have readily available.
Auto Trait Implementations§
impl<Prov> RefUnwindSafe for Scalar<Prov>where Prov: RefUnwindSafe,
impl<Prov> Send for Scalar<Prov>where Prov: Send,
impl<Prov> Sync for Scalar<Prov>where Prov: Sync,
impl<Prov> Unpin for Scalar<Prov>where Prov: Unpin,
impl<Prov> UnwindSafe for Scalar<Prov>where Prov: UnwindSafe,
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
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.