Trait ProvideBox

Source
pub trait ProvideBox<L: Lt = ()> {
    // Required methods
    fn provide_box<'this>(
        self: Box<Self>,
        query: &mut Query<'_, L>,
    ) -> Option<Box<dyn ProvideBox<L> + 'this>>
       where Self: 'this;
    fn provide_box_send<'this>(
        self: Box<Self>,
        query: &mut Query<'_, L>,
    ) -> Option<Box<dyn ProvideBox<L> + Send + 'this>>
       where Self: 'this + Send;
    fn provide_box_send_sync<'this>(
        self: Box<Self>,
        query: &mut Query<'_, L>,
    ) -> Option<Box<dyn ProvideBox<L> + Send + Sync + 'this>>
       where Self: 'this + Send + Sync;
}
Available on crate feature alloc only.
Expand description

Provides values from a Box.

Auto-implemented for Provide<L> implementations. In turn, Provide<L> is implemented for the following:

  • Box<dyn ProvideBox<L>>
  • Box<dyn ProvideBox<L> + Send>
  • Box<dyn ProvideBox<L> + Send + Sync>

Required Methods§

Source

fn provide_box<'this>( self: Box<Self>, query: &mut Query<'_, L>, ) -> Option<Box<dyn ProvideBox<L> + 'this>>
where Self: 'this,

Requests that the inner provider fulfill the query.

If the request fails, a Box<dyn ProvideBox<L>> is returned.

Source

fn provide_box_send<'this>( self: Box<Self>, query: &mut Query<'_, L>, ) -> Option<Box<dyn ProvideBox<L> + Send + 'this>>
where Self: 'this + Send,

Requests that the inner provider fulfill the query.

If the request fails, a Box<dyn ProvideBox<L> + Send> is returned.

Source

fn provide_box_send_sync<'this>( self: Box<Self>, query: &mut Query<'_, L>, ) -> Option<Box<dyn ProvideBox<L> + Send + Sync + 'this>>
where Self: 'this + Send + Sync,

Requests that the inner provider fulfill the query.

If the request fails, a Box<dyn ProvideBox<L> + Send + Sync> is returned.

Trait Implementations§

Source§

impl<'data, L: Lt + 'data> Provide<L> for Box<dyn ProvideBox<L> + 'data>

Source§

fn provide(self, query: &mut Query<'_, L>) -> Option<Self>

Supplies the requested value to the given Query, if available. Read more
Source§

fn request<Tag: TagFor<L>>(self, arg: Tag::ArgValue) -> Result<Tag::Value, Self>

Requests the value specified by Tag. Returns Err(self) if the value was not available. Read more
Source§

fn request_value<T: 'static>(self) -> Result<T, Self>

Requests a value of type T, marked by the tag Value<T>. Values of type T must not hold any borrowed data.
Source§

fn request_ref<'x, T: 'static + ?Sized>(self) -> Result<&'x T, Self>
where Ref<Value<T>>: TagFor<L, ArgValue = (), Value = &'x T>,

Requests a shared reference to a value of type T, marked by the tag Ref<Value<T>>. Values of type T must not hold any borrowed data.
Source§

fn request_mut<'x, T: 'static + ?Sized>(self) -> Result<&'x mut T, Self>
where Mut<Value<T>>: TagFor<L, ArgValue = (), Value = &'x mut T>,

Requests a unique reference to a value of type T, marked by the tag Mut<Value<T>>. Values of type T must not hold any borrowed data.
Source§

impl<'data, L: Lt + 'data> Provide<L> for Box<dyn ProvideBox<L> + Send + 'data>

Source§

fn provide(self, query: &mut Query<'_, L>) -> Option<Self>

Supplies the requested value to the given Query, if available. Read more
Source§

fn request<Tag: TagFor<L>>(self, arg: Tag::ArgValue) -> Result<Tag::Value, Self>

Requests the value specified by Tag. Returns Err(self) if the value was not available. Read more
Source§

fn request_value<T: 'static>(self) -> Result<T, Self>

Requests a value of type T, marked by the tag Value<T>. Values of type T must not hold any borrowed data.
Source§

fn request_ref<'x, T: 'static + ?Sized>(self) -> Result<&'x T, Self>
where Ref<Value<T>>: TagFor<L, ArgValue = (), Value = &'x T>,

Requests a shared reference to a value of type T, marked by the tag Ref<Value<T>>. Values of type T must not hold any borrowed data.
Source§

fn request_mut<'x, T: 'static + ?Sized>(self) -> Result<&'x mut T, Self>
where Mut<Value<T>>: TagFor<L, ArgValue = (), Value = &'x mut T>,

Requests a unique reference to a value of type T, marked by the tag Mut<Value<T>>. Values of type T must not hold any borrowed data.
Source§

impl<'data, L: Lt + 'data> Provide<L> for Box<dyn ProvideBox<L> + Send + Sync + 'data>

Source§

fn provide(self, query: &mut Query<'_, L>) -> Option<Self>

Supplies the requested value to the given Query, if available. Read more
Source§

fn request<Tag: TagFor<L>>(self, arg: Tag::ArgValue) -> Result<Tag::Value, Self>

Requests the value specified by Tag. Returns Err(self) if the value was not available. Read more
Source§

fn request_value<T: 'static>(self) -> Result<T, Self>

Requests a value of type T, marked by the tag Value<T>. Values of type T must not hold any borrowed data.
Source§

fn request_ref<'x, T: 'static + ?Sized>(self) -> Result<&'x T, Self>
where Ref<Value<T>>: TagFor<L, ArgValue = (), Value = &'x T>,

Requests a shared reference to a value of type T, marked by the tag Ref<Value<T>>. Values of type T must not hold any borrowed data.
Source§

fn request_mut<'x, T: 'static + ?Sized>(self) -> Result<&'x mut T, Self>
where Mut<Value<T>>: TagFor<L, ArgValue = (), Value = &'x mut T>,

Requests a unique reference to a value of type T, marked by the tag Mut<Value<T>>. Values of type T must not hold any borrowed data.

Implementors§

Source§

impl<P: Provide<L>, L: Lt> ProvideBox<L> for P