#[repr(C)]pub struct TypedObject {
pub schema_id: u32,
pub ref_count: u32,
}Expand description
A typed object with fixed field layout for O(1) access.
This struct uses #[repr(C)] to ensure predictable memory layout.
Fields are stored inline after the header, accessed by byte offset.
Fields§
§schema_id: u32Schema ID for runtime type checking
ref_count: u32Reference count for garbage collection
Implementations§
Source§impl TypedObject
impl TypedObject
Sourcepub fn alloc(schema: &TypeSchema) -> *mut TypedObject
pub fn alloc(schema: &TypeSchema) -> *mut TypedObject
Allocate a new typed object for the given schema.
Returns a pointer to the newly allocated object, or null on failure. The object is zero-initialized.
§Safety
Caller must ensure the returned pointer is eventually freed via dealloc_typed_object.
Source§impl TypedObject
impl TypedObject
Sourcepub unsafe fn get_field(&self, offset: usize) -> u64
pub unsafe fn get_field(&self, offset: usize) -> u64
Get a field value at the given byte offset.
§Safety
Caller must ensure:
offsetis valid for this object’s schemaoffsetis 8-byte aligned- The object is properly initialized
Sourcepub unsafe fn set_field(&mut self, offset: usize, value: u64)
pub unsafe fn set_field(&mut self, offset: usize, value: u64)
Set a field value at the given byte offset.
§Safety
Caller must ensure:
offsetis valid for this object’s schemaoffsetis 8-byte aligned- The object is properly initialized
Sourcepub unsafe fn get_field_f64(&self, offset: usize) -> f64
pub unsafe fn get_field_f64(&self, offset: usize) -> f64
Get a field value as f64 at the given byte offset.
Sourcepub unsafe fn set_field_f64(&mut self, offset: usize, value: f64)
pub unsafe fn set_field_f64(&mut self, offset: usize, value: f64)
Set a field value as f64 at the given byte offset.
Sourcepub unsafe fn get_field_i64(&self, offset: usize) -> i64
pub unsafe fn get_field_i64(&self, offset: usize) -> i64
Get a field value as i64 at the given byte offset.
Sourcepub unsafe fn set_field_i64(&mut self, offset: usize, value: i64)
pub unsafe fn set_field_i64(&mut self, offset: usize, value: i64)
Set a field value as i64 at the given byte offset.
Sourcepub unsafe fn get_field_bool(&self, offset: usize) -> bool
pub unsafe fn get_field_bool(&self, offset: usize) -> bool
Get a field value as bool at the given byte offset.
Sourcepub unsafe fn set_field_bool(&mut self, offset: usize, value: bool)
pub unsafe fn set_field_bool(&mut self, offset: usize, value: bool)
Set a field value as bool at the given byte offset.
Auto Trait Implementations§
impl Freeze for TypedObject
impl RefUnwindSafe for TypedObject
impl Send for TypedObject
impl Sync for TypedObject
impl Unpin for TypedObject
impl UnsafeUnpin for TypedObject
impl UnwindSafe for TypedObject
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> 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 more