pub struct AddonSpec {
pub name: AddonName,
pub dependencies: Vec<AddonName>,
pub modules: Vec<ModuleSpec>,
pub datasource: Option<DatasourceId>,
}Expand description
Addon 的产品能力定义。
Fields§
§name: AddonNameAddon 名称。
dependencies: Vec<AddonName>依赖的其它 Addon。
modules: Vec<ModuleSpec>Module 集合。
datasource: Option<DatasourceId>Addon 默认逻辑数据源;模块未显式声明时继承。
Implementations§
Source§impl AddonSpec
impl AddonSpec
Sourcepub fn datasource(self, id: DatasourceId) -> Self
pub fn datasource(self, id: DatasourceId) -> Self
设置 Addon 默认逻辑数据源;已加入的模块与其主表同步继承。
Sourcepub fn depends_on(self, dependency: AddonName) -> Self
pub fn depends_on(self, dependency: AddonName) -> Self
声明 Addon 依赖。
Sourcepub fn module(self, module: ModuleSpec) -> Self
pub fn module(self, module: ModuleSpec) -> Self
增加一个 Module。
Sourcepub fn middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware,
pub fn middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware,
向 Addon 的每个 Module 追加同一个跨切面中间件。
中间件位于各 Module 已声明中间件之前,适合让日志、trace 等跨切面观察包括认证 与租户解析失败在内的完整派发结果。所有 Module 共享同一个线程安全实例,不建立 第二条派发链。
Trait Implementations§
impl Eq for AddonSpec
impl StructuralPartialEq for AddonSpec
Auto Trait Implementations§
impl !RefUnwindSafe for AddonSpec
impl !UnwindSafe for AddonSpec
impl Forget for AddonSpec
impl Freeze for AddonSpec
impl Move for AddonSpec
impl Send for AddonSpec
impl Sync for AddonSpec
impl Unpin for AddonSpec
impl UnsafeUnpin for AddonSpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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