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§
Sourcefn provide_ref<'this>(&'this self, query: &mut Query<'_, LtList<'this, LTail>>)
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.
Sourcefn provide_mut<'this>(
&'this mut self,
query: &mut Query<'_, LtList<'this, LTail>>,
)
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§
impl<L: Lt> ProvideRef<L> for Infallible
Source§impl<L: Lt> ProvideRef<L> for str
impl<L: Lt> ProvideRef<L> for str
fn provide_ref<'x>(&'x self, query: &mut Query<'_, LtList<'x, L>>)
impl<L: Lt> ProvideRef<L> for ()
Source§impl<LTail: Lt> ProvideRef<LTail> for String
Available on crate feature alloc
only.
impl<LTail: Lt> ProvideRef<LTail> for String
Available on crate feature
alloc
only.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>
impl<LTail: Lt, P: ProvideRef<LTail>> ProvideRef<LTail> for &mut Option<P>
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>>, )
Source§impl<P: ?Sized + ProvideRef<LTail>, LTail: Lt> ProvideRef<LTail> for Box<P>
Available on crate feature alloc
only.
impl<P: ?Sized + ProvideRef<LTail>, LTail: Lt> ProvideRef<LTail> for Box<P>
Available on crate feature
alloc
only.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>>, )
Source§impl<P: ?Sized + ProvideRef<LTail>, LTail: Lt> ProvideRef<LTail> for Rc<P>
Available on crate feature alloc
only.
impl<P: ?Sized + ProvideRef<LTail>, LTail: Lt> ProvideRef<LTail> for Rc<P>
Available on crate feature
alloc
only.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>>, )
Source§impl<P: ?Sized + ProvideRef<LTail>, LTail: Lt> ProvideRef<LTail> for Arc<P>
Available on crate feature alloc
only.
impl<P: ?Sized + ProvideRef<LTail>, LTail: Lt> ProvideRef<LTail> for Arc<P>
Available on crate feature
alloc
only.