Struct rin::ecs::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>(&self) -> Option<ReadGuardRef<'_, T>> where
T: 'static,
[src]
T: 'static,
pub fn get_mut<T>(&self) -> Option<WriteGuardRef<'_, T, ()>> where
T: 'static,
[src]
T: 'static,
pub fn as_trait<T>(&self) -> Option<ReadGuardRef<'_, T>> where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
pub fn as_trait_mut<T>(&self) -> Option<WriteGuardRef<'_, T, ()>> where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
pub fn to_send(&mut self) -> Resources<'_>
[src]
pub fn to_thread_local(&mut self) -> ResourcesThreadLocal<'_>
[src]
pub fn add<T>(&mut self, resource: T) where
T: 'static + Send,
[src]
T: 'static + Send,
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>(&mut self, resource: T) where
T: 'static,
[src]
T: 'static,
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, F, FMut>(&mut self, resource: (T, F, FMut)) where
T: 'static + Send,
F: Fn(&T) -> &U + 'static,
U: 'static + Send + ?Sized,
FMut: Fn(&mut T) -> &mut U + 'static,
[src]
T: 'static + Send,
F: Fn(&T) -> &U + 'static,
U: 'static + Send + ?Sized,
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, F, FMut>(
&mut self,
resource: (T, F, FMut)
) where
T: 'static,
F: Fn(&T) -> &U + 'static,
U: 'static + ?Sized,
FMut: Fn(&mut T) -> &mut U + 'static,
[src]
&mut self,
resource: (T, F, FMut)
) where
T: 'static,
F: Fn(&T) -> &U + 'static,
U: 'static + ?Sized,
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>(&mut self) -> Option<T> where
T: 'static,
[src]
T: 'static,
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]pub fn with_resources_creation<F, R>(&mut self, f: F) -> R where
F: FnOnce(ResourcesCreation<'_>) -> R,
[src]
F: FnOnce(ResourcesCreation<'_>) -> R,
pub fn add_resource<T>(&mut self, resource: T) where
T: 'static + Send,
[src]
T: 'static + Send,
pub fn remove_resource<T>(&mut self) -> Option<T> where
T: 'static,
[src]
T: 'static,
pub fn add_resource_thread_local<T>(&mut self, resource: T) where
T: 'static,
[src]
T: 'static,
pub fn add_resource_as_trait<T, U, F, FMut>(&mut self, resource: (T, F, FMut)) where
T: 'static + Send,
F: Fn(&T) -> &U + 'static,
U: 'static + Send + ?Sized,
FMut: Fn(&mut T) -> &mut U + 'static,
[src]
T: 'static + Send,
F: Fn(&T) -> &U + 'static,
U: 'static + Send + ?Sized,
FMut: Fn(&mut T) -> &mut U + 'static,
pub fn add_resource_as_trait_thread_local<T, U, F, FMut>(
&mut self,
resource: (T, F, FMut)
) where
T: 'static,
F: Fn(&T) -> &U + 'static,
U: 'static + ?Sized,
FMut: Fn(&mut T) -> &mut U + 'static,
[src]
&mut self,
resource: (T, F, FMut)
) where
T: 'static,
F: Fn(&T) -> &U + 'static,
U: 'static + ?Sized,
FMut: Fn(&mut T) -> &mut U + 'static,
impl<'a> ResourcesExt for ResourcesCreation<'a>
[src]
impl<'a> ResourcesExt for ResourcesCreation<'a>
[src]pub fn resource<T>(&self) -> Option<ReadGuardRef<'_, T>> where
T: 'static + Send,
[src]
T: 'static + Send,
pub fn resource_mut<T>(&self) -> Option<WriteGuardRef<'_, T, ()>> where
T: 'static + Send,
[src]
T: 'static + Send,
pub fn resource_as_trait<T>(&self) -> Option<ReadGuardRef<'_, T>> where
T: 'static + Send + ?Sized,
[src]
T: 'static + Send + ?Sized,
pub fn resource_as_trait_mut<T>(&self) -> Option<WriteGuardRef<'_, T, ()>> where
T: 'static + Send + ?Sized,
[src]
T: 'static + Send + ?Sized,
impl<'a> ResourcesThreadLocalExt for ResourcesCreation<'a>
[src]
impl<'a> ResourcesThreadLocalExt for ResourcesCreation<'a>
[src]pub fn resource_thread_local<T>(&self) -> Option<ReadGuardRef<'_, T>> where
T: 'static,
[src]
T: 'static,
pub fn resource_thread_local_mut<T>(&self) -> Option<WriteGuardRef<'_, T, ()>> where
T: 'static,
[src]
T: 'static,
pub fn resource_as_trait_thread_local<T>(&self) -> Option<ReadGuardRef<'_, T>> where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
pub fn resource_as_trait_thread_local_mut<T>(
&self
) -> Option<WriteGuardRef<'_, T, ()>> where
T: 'static + ?Sized,
[src]
&self
) -> Option<WriteGuardRef<'_, T, ()>> where
T: 'static + ?Sized,
Auto Trait Implementations
impl<'a> !RefUnwindSafe for ResourcesCreation<'a>
impl<'a> !Send for ResourcesCreation<'a>
impl<'a> !Sync for ResourcesCreation<'a>
impl<'a> Unpin for ResourcesCreation<'a>
impl<'a> !UnwindSafe for ResourcesCreation<'a>
Blanket Implementations
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]