pub trait Resource: 'static + Any + Send + Sync { }
Expand description

A resource is a data slot which lives in the World can only be accessed according to Rust’s typical borrowing model (one writer xor multiple readers).

Implementations

Returns the boxed value if it is of type T, or Err(Self) if it isn’t.

Returns the boxed value, blindly assuming it to be of type T.

Safety

If you are not absolutely certain of T, you must not call this. Using anything other than the correct type T for this Resource will result in UB.

Returns true if the boxed type is the same as T

Returns some reference to the boxed value if it is of type T, or None if it isn’t.

Returns a reference to the boxed value, blindly assuming it to be of type T.

Safety

If you are not absolutely certain of T, you must not call this. Using anything other than the correct type T for this Resource will result in UB.

Returns some mutable reference to the boxed value if it is of type T, or None if it isn’t.

Returns a mutable reference to the boxed value, blindly assuming it to be of type T.

Safety

If you are not absolutely certain of T, you must not call this. Using anything other than the correct type T for this Resource will result in UB.

Implementors