pub struct Component;Expand description
Generic extractor for any component stored in the application.
This zero-sized type can be used to extract any component that has been
registered with the application builder using add_component().
§Examples
use diode::{App, Component, Extract};
let app = App::builder()
.add_component("configuration".to_string())
.build()
.await?;
// During service building:
// let config = Component::extract::<String>(app_builder)?;Trait Implementations§
Source§impl<T> Extract<T> for Component
impl<T> Extract<T> for Component
Source§fn extract(app: &AppBuilder) -> Result<T, AppError>
fn extract(app: &AppBuilder) -> Result<T, AppError>
Extracts a value of type
T from the application builder. Read moreSource§fn dependencies() -> Dependencies
fn dependencies() -> Dependencies
Returns the dependencies required by this type. Read more
Source§impl<T> ExtractRef<T> for Component
impl<T> ExtractRef<T> for Component
Source§fn extract_ref(app: &AppBuilder) -> Result<&T, AppError>
fn extract_ref(app: &AppBuilder) -> Result<&T, AppError>
Extracts a reference to a value of type
T from the application builder. Read moreSource§fn dependencies() -> Dependencies
fn dependencies() -> Dependencies
Returns the dependencies required by this type. Read more
Auto Trait Implementations§
impl Freeze for Component
impl RefUnwindSafe for Component
impl Send for Component
impl Sync for Component
impl Unpin for Component
impl UnwindSafe for Component
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more