pub struct BigResourceManager {
    resources: Vec<BigResource>,
}
Expand description

Represents a list of instances of the BigResource struct. Use the add_resource() method to add a BigResource instance to the list (and also take ownership of the BigResource instance). Call get_resource() with the ID of the resource to get the BigResource instance.

Fields§

§resources: Vec<BigResource>

Implementations§

source§

impl BigResourceManager

source

pub fn new() -> BigResourceManager

Constructor.

Returns

Returns a new instance of the BigResourceManager struct.

source

pub fn add_resource(&mut self, resource: BigResource) -> usize

Add a BigResource object to the list of big resources. The list takes ownership of the BigResource object.

Parameters
  • resource

    The BigResource to store in the manager.

Returns

Returns the “id” of the resource so it can be used to access the resource later on. Technically, the ID is actually the index where the BigResource instance appears in the internal list.

source

pub fn get_resource(&self, resource_id: usize) -> Option<&BigResource>

Retrieve the requested big resource.

Parameters
  • resource_id

    The ID of the resource to retrieve.

Returns

Returns Some(&BigResource) if the resource exists; otherwise, returns None.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V