Trait ProvideRef

Source
pub trait ProvideRef<LTail: Lt = ()> {
    // Provided methods
    fn provide_ref<'this>(
        &'this self,
        query: &mut Query<'_, LtList<'this, LTail>>,
    ) { ... }
    fn provide_mut<'this>(
        &'this mut self,
        query: &mut Query<'_, LtList<'this, LTail>>,
    ) { ... }
}
Expand description

Provides access to values of arbitrary type from a reference.

Requested values are specified using a ResourceTag implementation, or to be more specific, a TagFor<LTail> implementation.

ProvideRef implementations autmatically implement Provide<Lt!['x, ..LTail]> for all 'x.

Provided Methods§

Source

fn provide_ref<'this>(&'this self, query: &mut Query<'_, LtList<'this, LTail>>)

Supplies the requested value to the given Query from a shared reference to Self, if available.

The default implementation supplies nothing; override this method to supply values from a shared reference.

Source

fn provide_mut<'this>( &'this mut self, query: &mut Query<'_, LtList<'this, LTail>>, )

Supplies the requested value to the given Query from a unique reference to Self, if available.

The default implementation supplies nothing; override this method to supply values from a shared reference.

Implementations on Foreign Types§

Source§

impl<L: Lt> ProvideRef<L> for Infallible

Source§

impl<L: Lt> ProvideRef<L> for str

Source§

fn provide_ref<'x>(&'x self, query: &mut Query<'_, LtList<'x, L>>)

Source§

impl<L: Lt> ProvideRef<L> for ()

Source§

impl<LTail: Lt> ProvideRef<LTail> for String

Available on crate feature alloc only.
Source§

fn provide_ref<'this>(&'this self, query: &mut Query<'_, LtList<'this, LTail>>)

Source§

impl<LTail: Lt, P: ProvideRef<LTail>> ProvideRef<LTail> for &mut Option<P>

Source§

fn provide_ref<'this>(&'this self, query: &mut Query<'_, LtList<'this, LTail>>)

Source§

fn provide_mut<'this>( &'this mut self, query: &mut Query<'_, LtList<'this, LTail>>, )

Source§

impl<P: ?Sized + ProvideRef<LTail>, LTail: Lt> ProvideRef<LTail> for Box<P>

Available on crate feature alloc only.
Source§

fn provide_ref<'this>(&'this self, query: &mut Query<'_, LtList<'this, LTail>>)

Source§

fn provide_mut<'this>( &'this mut self, query: &mut Query<'_, LtList<'this, LTail>>, )

Source§

impl<P: ?Sized + ProvideRef<LTail>, LTail: Lt> ProvideRef<LTail> for Rc<P>

Available on crate feature alloc only.
Source§

fn provide_ref<'this>(&'this self, query: &mut Query<'_, LtList<'this, LTail>>)

Source§

fn provide_mut<'this>( &'this mut self, query: &mut Query<'_, LtList<'this, LTail>>, )

Source§

impl<P: ?Sized + ProvideRef<LTail>, LTail: Lt> ProvideRef<LTail> for Arc<P>

Available on crate feature alloc only.
Source§

fn provide_ref<'this>(&'this self, query: &mut Query<'_, LtList<'this, LTail>>)

Source§

fn provide_mut<'this>( &'this mut self, query: &mut Query<'_, LtList<'this, LTail>>, )

Implementors§