[−][src]Struct world_dispatcher::World
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: Default + 'static>(&mut self)
[src]
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: 'static>(&self) -> Result<Ref<'_, T>, EcsError>
[src]
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: 'static>(&self) -> Result<RefMut<'_, T>, EcsError>
[src]
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
impl !RefUnwindSafe for World
[src]
impl !Send for World
[src]
impl Unpin for World
[src]
impl !UnwindSafe for World
[src]
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,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
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>,