pub struct ComponentOps;Expand description
Zero-sized type hosting generic component FFI operations.
Implementations§
Source§impl ComponentOps
impl ComponentOps
Sourcepub unsafe fn register_type(
type_id_hash: u64,
name_ptr: *const u8,
name_len: usize,
size: usize,
align: usize,
) -> bool
pub unsafe fn register_type( type_id_hash: u64, name_ptr: *const u8, name_len: usize, size: usize, align: usize, ) -> bool
Registers a component type with the engine.
§Safety
name_ptrmust be a valid pointer to UTF-8 data (or null)sizeandalignmust match the actual type layout
Sourcepub unsafe fn add(
context_id: GoudContextId,
entity_id: GoudEntityId,
type_id_hash: u64,
data_ptr: *const u8,
data_size: usize,
) -> GoudFFIResult
pub unsafe fn add( context_id: GoudContextId, entity_id: GoudEntityId, type_id_hash: u64, data_ptr: *const u8, data_size: usize, ) -> GoudFFIResult
Adds a component to an entity.
§Safety
data_ptrmust point to valid component datadata_sizemust match the registered component size
Sourcepub fn remove(
context_id: GoudContextId,
entity_id: GoudEntityId,
type_id_hash: u64,
) -> GoudFFIResult
pub fn remove( context_id: GoudContextId, entity_id: GoudEntityId, type_id_hash: u64, ) -> GoudFFIResult
Removes a component from an entity.
Sourcepub fn has(
context_id: GoudContextId,
entity_id: GoudEntityId,
type_id_hash: u64,
) -> bool
pub fn has( context_id: GoudContextId, entity_id: GoudEntityId, type_id_hash: u64, ) -> bool
Checks if an entity has a specific component.
Sourcepub fn get(
context_id: GoudContextId,
entity_id: GoudEntityId,
type_id_hash: u64,
) -> *const u8
pub fn get( context_id: GoudContextId, entity_id: GoudEntityId, type_id_hash: u64, ) -> *const u8
Gets a read-only pointer to a component on an entity.
Sourcepub fn get_mut(
context_id: GoudContextId,
entity_id: GoudEntityId,
type_id_hash: u64,
) -> *mut u8
pub fn get_mut( context_id: GoudContextId, entity_id: GoudEntityId, type_id_hash: u64, ) -> *mut u8
Gets a mutable pointer to a component on an entity.
Sourcepub unsafe fn add_batch(
context_id: GoudContextId,
entity_ids: *const u64,
count: u32,
type_id_hash: u64,
data_ptr: *const u8,
component_size: usize,
) -> u32
pub unsafe fn add_batch( context_id: GoudContextId, entity_ids: *const u64, count: u32, type_id_hash: u64, data_ptr: *const u8, component_size: usize, ) -> u32
Adds the same component type to multiple entities in a batch.
§Safety
entity_idsmust point to valid memory withcountu64 valuesdata_ptrmust point tocount * component_sizebytes of data
Sourcepub unsafe fn remove_batch(
context_id: GoudContextId,
entity_ids: *const u64,
count: u32,
type_id_hash: u64,
) -> u32
pub unsafe fn remove_batch( context_id: GoudContextId, entity_ids: *const u64, count: u32, type_id_hash: u64, ) -> u32
Removes the same component type from multiple entities in a batch.
§Safety
entity_ids must point to valid memory with count u64 values.
Sourcepub unsafe fn has_batch(
context_id: GoudContextId,
entity_ids: *const u64,
count: u32,
type_id_hash: u64,
out_results: *mut u8,
) -> u32
pub unsafe fn has_batch( context_id: GoudContextId, entity_ids: *const u64, count: u32, type_id_hash: u64, out_results: *mut u8, ) -> u32
Checks if multiple entities have a specific component type.
§Safety
entity_idsmust point to valid memory withcountu64 valuesout_resultsmust point to valid memory withcountu8 values
Auto Trait Implementations§
impl Freeze for ComponentOps
impl RefUnwindSafe for ComponentOps
impl Send for ComponentOps
impl Sync for ComponentOps
impl Unpin for ComponentOps
impl UnsafeUnpin for ComponentOps
impl UnwindSafe for ComponentOps
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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>
Converts
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>
Converts
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