#[repr(C, packed(1))]pub struct DxMachineSlot {
pub data: [u8; 16],
}Expand description
16-byte slot that holds either inline data or heap reference
Fields§
§data: [u8; 16]Raw slot data (16 bytes)
Layout depends on marker byte (byte 15):
Inline (marker = 0x00):
[0]: length (0-14)[1-14]: inline data[15]: 0x00 (INLINE_MARKER)
Heap (marker = 0xFF):
[0-3]: heap offset (u32 LE)[4-7]: data length (u32 LE)[8-14]: reserved (zero)[15]: 0xFF (HEAP_MARKER)
Implementations§
Source§impl DxMachineSlot
impl DxMachineSlot
Sourcepub fn inline_from_bytes(bytes: &[u8]) -> Result<Self, SlotError>
pub fn inline_from_bytes(bytes: &[u8]) -> Result<Self, SlotError>
Create inline slot from data (≤14 bytes)
Sourcepub fn heap_reference(offset: u32, length: u32) -> Self
pub fn heap_reference(offset: u32, length: u32) -> Self
Create heap reference slot
Sourcepub const fn inline_len(&self) -> usize
pub const fn inline_len(&self) -> usize
Get inline data length (panics if not inline)
Sourcepub fn inline_data(&self) -> &[u8] ⓘ
pub fn inline_data(&self) -> &[u8] ⓘ
Get inline data (panics if not inline)
Sourcepub fn inline_str(&self) -> &str
pub fn inline_str(&self) -> &str
Get inline data as UTF-8 string (panics if not inline or invalid UTF-8)
§Panics
Panics if the inline data is not valid UTF-8. Use Self::inline_str_checked
for fallible conversion.
Sourcepub fn inline_str_checked(&self) -> Option<&str>
pub fn inline_str_checked(&self) -> Option<&str>
Get inline data as UTF-8 string, returning None if invalid UTF-8
This is the fallible version of Self::inline_str.
Sourcepub fn heap_offset(&self) -> u32
pub fn heap_offset(&self) -> u32
Get heap offset (panics if not heap)
Sourcepub fn heap_length(&self) -> u32
pub fn heap_length(&self) -> u32
Get heap data length (panics if not heap)
Sourcepub fn write_inline(&mut self, bytes: &[u8]) -> Result<(), SlotError>
pub fn write_inline(&mut self, bytes: &[u8]) -> Result<(), SlotError>
Write inline data to slot
Sourcepub fn write_heap(&mut self, offset: u32, length: u32)
pub fn write_heap(&mut self, offset: u32, length: u32)
Write heap reference to slot
Sourcepub fn eq_inline_bytes(&self, other: &[u8]) -> bool
pub fn eq_inline_bytes(&self, other: &[u8]) -> bool
Compare inline data with byte slice (optimized)
Sourcepub fn eq_inline_str(&self, other: &str) -> bool
pub fn eq_inline_str(&self, other: &str) -> bool
Compare inline data with string (optimized)
Trait Implementations§
Source§impl Clone for DxMachineSlot
impl Clone for DxMachineSlot
Source§fn clone(&self) -> DxMachineSlot
fn clone(&self) -> DxMachineSlot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DxMachineSlot
Source§impl Debug for DxMachineSlot
impl Debug for DxMachineSlot
Auto Trait Implementations§
impl Freeze for DxMachineSlot
impl RefUnwindSafe for DxMachineSlot
impl Send for DxMachineSlot
impl Sync for DxMachineSlot
impl Unpin for DxMachineSlot
impl UnsafeUnpin for DxMachineSlot
impl UnwindSafe for DxMachineSlot
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.