pub struct Dependencies { /* private fields */ }Expand description
Represents dependencies between plugins and services in the application.
The Dependencies struct is used to declare what other plugins or services
a particular plugin or service depends on. This information is used during
the build process to ensure proper initialization order.
§Examples
use diode::{Dependencies, Plugin, StdError};
struct DatabasePlugin;
struct ApiPlugin;
impl Plugin for DatabasePlugin {
async fn build(&self, _app: &mut diode::AppBuilder) -> Result<(), StdError> {
Ok(())
}
}
impl Plugin for ApiPlugin {
async fn build(&self, _app: &mut diode::AppBuilder) -> Result<(), StdError> {
Ok(())
}
fn dependencies(&self) -> Dependencies {
Dependencies::new().plugin::<DatabasePlugin>()
}
}Implementations§
Source§impl Dependencies
impl Dependencies
Sourcepub fn plugin<T>(self) -> Selfwhere
T: Plugin + 'static,
pub fn plugin<T>(self) -> Selfwhere
T: Plugin + 'static,
Adds a plugin dependency to this dependencies set.
§Type Parameters
T- The plugin type to depend on. Must implementPlugin + 'static.
§Returns
Returns Self for method chaining.
§Examples
use diode::{Dependencies, Plugin, StdError};
struct DatabasePlugin;
impl Plugin for DatabasePlugin {
async fn build(&self, _app: &mut diode::AppBuilder) -> Result<(), StdError> {
Ok(())
}
}
let deps = Dependencies::new().plugin::<DatabasePlugin>();Sourcepub fn merge(self, other: Dependencies) -> Self
pub fn merge(self, other: Dependencies) -> Self
Trait Implementations§
Source§impl Clone for Dependencies
impl Clone for Dependencies
Source§fn clone(&self) -> Dependencies
fn clone(&self) -> Dependencies
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for Dependencies
impl Default for Dependencies
Source§impl ServiceDependencyExt for Dependencies
impl ServiceDependencyExt for Dependencies
Auto Trait Implementations§
impl Freeze for Dependencies
impl RefUnwindSafe for Dependencies
impl Send for Dependencies
impl Sync for Dependencies
impl Unpin for Dependencies
impl UnwindSafe for Dependencies
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