pub struct Locator { /* private fields */ }Expand description
A Locator allows a WASM developer located any field in any object (even nested fields) by
specifying a slot_num (1 byte); a locator_field_type (1 byte); then one of an sfield (4
bytes) or an index (4 bytes).
§Derived Traits
Debug: Useful for development and debuggingClone: Reasonable for this 72-byte struct when explicit copying is neededEq, PartialEq: Enable comparisons between locators
Note: Copy is intentionally not derived due to the struct’s size (72 bytes).
Large Copy types can lead to accidental expensive copies and poor performance.
Use .clone() when you need to duplicate a locator.
Implementations§
Source§impl Locator
impl Locator
Sourcepub fn new_with_slot(slot_num: u8) -> Locator
pub fn new_with_slot(slot_num: u8) -> Locator
Create a new Locator using an unsigned 8-bit slot number. Valid slots are 0 to 255.
pub fn pack(&mut self, sfield_or_index: i32) -> bool
pub fn as_ptr(&self) -> *const u8
pub fn num_packed_bytes(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn repack_last(&mut self, sfield_or_index: i32) -> bool
Trait Implementations§
impl Eq for Locator
impl StructuralPartialEq for Locator
Auto Trait Implementations§
impl Freeze for Locator
impl RefUnwindSafe for Locator
impl Send for Locator
impl Sync for Locator
impl Unpin for Locator
impl UnwindSafe for Locator
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