Struct plank_ecs::World [−][src]
Contains data indexed by type. World allows to dynamically enforce the rust rules of borrowing and ownership at runtime:
- The same type cannot be borrowed immutably and mutably at the same time.
- The same type cannot be borrowed mutably more than once at the same time.
Implementations
impl World
[src]
pub fn initialize<T>(&mut self) where
T: 'static + Default,
[src]
T: 'static + Default,
Initializes a resource to its default value. This is the only way to “insert” a resource.
It is suggested to use a macro to collect all the resources and initialize all of them.
pub fn get<T>(&self) -> Result<Ref<'_, T>, EcsError> where
T: 'static,
[src]
T: 'static,
Get an immutable reference to a resource by type. Will return an error if the type is:
- Non initialized
- Already borrowed mutably
pub fn get_mut<T>(&self) -> Result<RefMut<'_, T>, EcsError> where
T: 'static,
[src]
T: 'static,
Get a mutable reference to a resource by type. Will return an error if the type is:
- Non initialized
- Already borrowed immutably
- Already borrowed mutably
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,