pub struct ComponentInfo {
pub id: ComponentId,
pub name: &'static str,
pub size: usize,
pub align: usize,
}Expand description
Metadata about a component type.
Provides runtime information about a component including its name, size, and alignment. Useful for debugging, reflection, and memory layout calculations.
§Example
use goud_engine::ecs::{Component, ComponentInfo};
struct Position { x: f32, y: f32 }
impl Component for Position {}
let info = ComponentInfo::of::<Position>();
println!("Component: {} (size: {}, align: {})", info.name, info.size, info.align);Fields§
§id: ComponentIdUnique identifier for this component type.
name: &'static strType name (from std::any::type_name).
size: usizeSize in bytes.
align: usizeMemory alignment in bytes.
Implementations§
Source§impl ComponentInfo
impl ComponentInfo
Sourcepub fn of<T: Component>() -> Self
pub fn of<T: Component>() -> Self
Creates ComponentInfo for the given component type.
§Example
use goud_engine::ecs::{Component, ComponentInfo};
struct Velocity { x: f32, y: f32 }
impl Component for Velocity {}
let info = ComponentInfo::of::<Velocity>();
assert_eq!(info.size, std::mem::size_of::<Velocity>());Trait Implementations§
Source§impl Clone for ComponentInfo
impl Clone for ComponentInfo
Source§fn clone(&self) -> ComponentInfo
fn clone(&self) -> ComponentInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ComponentInfo
impl RefUnwindSafe for ComponentInfo
impl Send for ComponentInfo
impl Sync for ComponentInfo
impl Unpin for ComponentInfo
impl UnsafeUnpin for ComponentInfo
impl UnwindSafe for ComponentInfo
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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