add formal wrapping for api state
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
5c258f41c8
commit
ccef1a4c8b
4 changed files with 27 additions and 7 deletions
22
src/api/router/state.rs
Normal file
22
src/api/router/state.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
use std::{ops::Deref, sync::Arc};
|
||||
|
||||
use conduit_service::Services;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct State {
|
||||
services: Arc<Services>,
|
||||
}
|
||||
|
||||
impl State {
|
||||
pub fn new(services: Arc<Services>) -> Self {
|
||||
Self {
|
||||
services,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for State {
|
||||
type Target = Arc<Services>;
|
||||
|
||||
fn deref(&self) -> &Self::Target { &self.services }
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue