pub struct AppState {
pub attribute_service: Arc<AttributeService>,
pub attribute_value_service: Arc<AttributeValueService>,
pub brand_service: Arc<BrandService>,
pub item_service: Arc<ItemService>,
pub item_group_service: Arc<ItemGroupService>,
pub item_variant_service: Arc<ItemVariantService>,
pub uom_service: Arc<UomService>,
pub uom_conversion_service: Arc<UomConversionService>,
}Expand description
Application state for dependency injection.
This struct holds references to all module services and is passed to HTTP handlers via Axum’s State extractor.
§Example
ⓘ
use axum::extract::State;
async fn custom_handler(
State(state): State<AppState>,
) -> impl IntoResponse {
// Access services via state
}Fields§
§attribute_service: Arc<AttributeService>Attribute service
attribute_value_service: Arc<AttributeValueService>AttributeValue service
brand_service: Arc<BrandService>Brand service
item_service: Arc<ItemService>Item service
item_group_service: Arc<ItemGroupService>ItemGroup service
item_variant_service: Arc<ItemVariantService>ItemVariant service
uom_service: Arc<UomService>Uom service
uom_conversion_service: Arc<UomConversionService>UomConversion service
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new(
attribute_service: Arc<AttributeService>,
attribute_value_service: Arc<AttributeValueService>,
brand_service: Arc<BrandService>,
item_service: Arc<ItemService>,
item_group_service: Arc<ItemGroupService>,
item_variant_service: Arc<ItemVariantService>,
uom_service: Arc<UomService>,
uom_conversion_service: Arc<UomConversionService>,
) -> Self
pub fn new( attribute_service: Arc<AttributeService>, attribute_value_service: Arc<AttributeValueService>, brand_service: Arc<BrandService>, item_service: Arc<ItemService>, item_group_service: Arc<ItemGroupService>, item_variant_service: Arc<ItemVariantService>, uom_service: Arc<UomService>, uom_conversion_service: Arc<UomConversionService>, ) -> Self
Create a new AppState with all services.
Sourcepub fn from_module(module: &CatalogModule) -> Self
pub fn from_module(module: &CatalogModule) -> Self
Create AppState from module instance.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AppState
impl !UnwindSafe for AppState
impl Freeze for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more