Struct rinecs::ResourcesCreation [−][src]
pub struct ResourcesCreation<'a> { /* fields omitted */ }
Gives access to the world global Send
and thread local resources
for reading and writing
Resources are useful for certain data that needs to be accessed from several systems but doesn’t belong to any specific entity
It’s similar to a singleton in that it can be accessed from any system and there’s only one instance per type
Implementations
impl<'a> ResourcesCreation<'a>
[src]
impl<'a> ResourcesCreation<'a>
[src]pub fn get<T: 'static>(&self) -> Option<ReadGuardRef<'_, T>>
[src]
pub fn get_mut<T: 'static>(&self) -> Option<WriteGuardRef<'_, T>>
[src]
pub fn as_trait<T: 'static + ?Sized>(&self) -> Option<ReadGuardRef<'_, T>>
[src]
pub fn as_trait_mut<T: 'static + ?Sized>(&self) -> Option<WriteGuardRef<'_, T>>
[src]
pub fn to_send(&mut self) -> Resources<'_>
[src]
pub fn to_thread_local(&mut self) -> ResourcesThreadLocal<'_>
[src]
pub fn add<T: 'static + Send>(&mut self, resource: T)
[src]
Adds a Send
resource to the world.
Resources are globally accesible by any system through
the Resources
object passed as parameter to them.
pub fn add_thread_local<T: 'static>(&mut self, resource: T)
[src]
Adds a non Send
resource to the world.
Non Send
resources are globally accesible by any SystemThreadLocal
through the ResourcesThreadLocal
object passed as parameter to them.
pub fn add_as_trait<T, U: ?Sized, F, FMut>(&mut self, resource: (T, F, FMut)) where
T: 'static + Send,
U: 'static + Send,
F: Fn(&T) -> &U + 'static,
FMut: Fn(&mut T) -> &mut U + 'static,
[src]
T: 'static + Send,
U: 'static + Send,
F: Fn(&T) -> &U + 'static,
FMut: Fn(&mut T) -> &mut U + 'static,
Adds a Send
resource to the world accessible as a &dyn Trait.
Resources are globally accesible by any system through
the Resources
object passed as parameter to them.
pub fn add_as_trait_thread_local<T, U: ?Sized, F, FMut>(
&mut self,
resource: (T, F, FMut)
) where
T: 'static,
U: 'static,
F: Fn(&T) -> &U + 'static,
FMut: Fn(&mut T) -> &mut U + 'static,
[src]
&mut self,
resource: (T, F, FMut)
) where
T: 'static,
U: 'static,
F: Fn(&T) -> &U + 'static,
FMut: Fn(&mut T) -> &mut U + 'static,
Adds a non Send
resource to the world accessible as a &dyn Trait.
Resources are globally accesible by any system through
the Resources
object passed as parameter to them.
pub fn remove<T: 'static>(&mut self) -> Option<T>
[src]
Removes a resource of the specified type.
pub fn clone(&mut self) -> ResourcesCreation<'_>
[src]
Trait Implementations
impl<'a> ResourcesCreationExt for ResourcesCreation<'a>
[src]
impl<'a> ResourcesCreationExt for ResourcesCreation<'a>
[src]fn with_resources_creation<F, R>(&mut self, f: F) -> R where
F: FnOnce(ResourcesCreation<'_>) -> R,
[src]
F: FnOnce(ResourcesCreation<'_>) -> R,
fn add_resource<T: 'static + Send>(&mut self, resource: T)
[src]
fn remove_resource<T: 'static>(&mut self) -> Option<T>
[src]
fn add_resource_thread_local<T: 'static>(&mut self, resource: T)
[src]
fn add_resource_as_trait<T, U: ?Sized, F, FMut>(
&mut self,
resource: (T, F, FMut)
) where
T: 'static + Send,
U: 'static + Send,
F: Fn(&T) -> &U + 'static,
FMut: Fn(&mut T) -> &mut U + 'static,
[src]
&mut self,
resource: (T, F, FMut)
) where
T: 'static + Send,
U: 'static + Send,
F: Fn(&T) -> &U + 'static,
FMut: Fn(&mut T) -> &mut U + 'static,
fn add_resource_as_trait_thread_local<T, U: ?Sized, F, FMut>(
&mut self,
resource: (T, F, FMut)
) where
T: 'static,
U: 'static,
F: Fn(&T) -> &U + 'static,
FMut: Fn(&mut T) -> &mut U + 'static,
[src]
&mut self,
resource: (T, F, FMut)
) where
T: 'static,
U: 'static,
F: Fn(&T) -> &U + 'static,
FMut: Fn(&mut T) -> &mut U + 'static,
impl<'a> ResourcesExt for ResourcesCreation<'a>
[src]
impl<'a> ResourcesExt for ResourcesCreation<'a>
[src]fn resource<T: 'static + Send>(&self) -> Option<ReadGuardRef<'_, T>>
[src]
fn resource_mut<T: 'static + Send>(&self) -> Option<WriteGuardRef<'_, T>>
[src]
fn resource_as_trait<T: 'static + Send + ?Sized>(
&self
) -> Option<ReadGuardRef<'_, T>>
[src]
&self
) -> Option<ReadGuardRef<'_, T>>
fn resource_as_trait_mut<T: 'static + Send + ?Sized>(
&self
) -> Option<WriteGuardRef<'_, T>>
[src]
&self
) -> Option<WriteGuardRef<'_, T>>
impl<'a> ResourcesThreadLocalExt for ResourcesCreation<'a>
[src]
impl<'a> ResourcesThreadLocalExt for ResourcesCreation<'a>
[src]fn resource_thread_local<T: 'static>(&self) -> Option<ReadGuardRef<'_, T>>
[src]
fn resource_thread_local_mut<T: 'static>(&self) -> Option<WriteGuardRef<'_, T>>
[src]
fn resource_as_trait_thread_local<T: 'static + ?Sized>(
&self
) -> Option<ReadGuardRef<'_, T>>
[src]
&self
) -> Option<ReadGuardRef<'_, T>>
fn resource_as_trait_thread_local_mut<T: 'static + ?Sized>(
&self
) -> Option<WriteGuardRef<'_, T>>
[src]
&self
) -> Option<WriteGuardRef<'_, T>>