pub struct Resources { /* private fields */ }
Expand description

A collection of resources.

Resources is essentially a type-map

Implementations§

Create an empty Resources.

Initialize a resource of type T by inserting it’s default value.

Insert a resource.

Panics

Panics if you try to insert a Rust type with a different TypeId, but the same TypeUlid as another resource in the store.

Try to insert a resource.

Errors

Errors if you try to insert a Rust type with a different TypeId, but the same TypeUlid as another resource in the store.

Get a resource handle from the store.

This is not the resource itself, but a handle, may be cloned cheaply.

In order to access the resource you must call borrow() or borrow_mut() on the returned value.

Panics

Panics if the resource does not exist in the store.

Check whether or not a resource is in the store.

See get()

Gets a resource handle from the store if it exists.

Borrow the underlying UntypedResources store.

Mutably borrow the underlying UntypedResources store.

Consume Resources and extract the underlying UntypedResources.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Drop the value at ptr. Read more
Clone the value at src, writing the new value to dst. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.