[][src]Trait specs::prelude::Resource

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

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).

Methods

impl dyn Resource + 'static

pub fn downcast<T>(
    self: Box<dyn Resource + 'static>
) -> Result<Box<T>, Box<dyn Resource + 'static>> where
    T: Resource

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

pub unsafe fn downcast_unchecked<T>(self: Box<dyn Resource + 'static>) -> Box<T> where
    T: Resource

Returns the boxed value, blindly assuming it to be of type T. If you are not absolutely certain of T, you must not call this.

impl dyn Resource + 'static

pub fn is<T>(&self) -> bool where
    T: Resource

Returns true if the boxed type is the same as T

pub fn downcast_ref<T>(&self) -> Option<&T> where
    T: Resource

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

pub unsafe fn downcast_ref_unchecked<T>(&self) -> &T where
    T: Resource

Returns a reference to the boxed value, blindly assuming it to be of type T. If you are not absolutely certain of T, you must not call this.

pub fn downcast_mut<T>(&mut self) -> Option<&mut T> where
    T: Resource

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

pub unsafe fn downcast_mut_unchecked<T>(&mut self) -> &mut T where
    T: Resource

Returns a mutable reference to the boxed value, blindly assuming it to be of type T. If you are not absolutely certain of T, you must not call this.

Implementors

impl<T> Resource for T where
    T: Any + Send + Sync
[src]

Loading content...