pub struct ControllerSpec {
pub before: Option<String>,
pub after: Option<String>,
}Expand description
Controller specification for synchronous in-request business logic.
Declared per-endpoint in the resource YAML:
controller:
before: validate_org
after: enrich_responseFunctions live in resources/<resource>.controller.rs and are called
synchronously within the request lifecycle (before/after the DB operation).
Fields§
§before: Option<String>Function to call before the DB operation.
after: Option<String>Function to call after the DB operation.
Implementations§
Source§impl ControllerSpec
impl ControllerSpec
Sourcepub fn has_wasm_before(&self) -> bool
pub fn has_wasm_before(&self) -> bool
Returns true if the before controller references a WASM plugin.
Sourcepub fn has_wasm_after(&self) -> bool
pub fn has_wasm_after(&self) -> bool
Returns true if the after controller references a WASM plugin.
Sourcepub fn wasm_before_path(&self) -> Option<&str>
pub fn wasm_before_path(&self) -> Option<&str>
Extracts the WASM plugin path from a before controller, if present.
Sourcepub fn wasm_after_path(&self) -> Option<&str>
pub fn wasm_after_path(&self) -> Option<&str>
Extracts the WASM plugin path from an after controller, if present.
Trait Implementations§
Source§impl Clone for ControllerSpec
impl Clone for ControllerSpec
Source§fn clone(&self) -> ControllerSpec
fn clone(&self) -> ControllerSpec
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 Debug for ControllerSpec
impl Debug for ControllerSpec
Source§impl<'de> Deserialize<'de> for ControllerSpec
impl<'de> Deserialize<'de> for ControllerSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ControllerSpec
impl PartialEq for ControllerSpec
Source§impl Serialize for ControllerSpec
impl Serialize for ControllerSpec
impl StructuralPartialEq for ControllerSpec
Auto Trait Implementations§
impl Freeze for ControllerSpec
impl RefUnwindSafe for ControllerSpec
impl Send for ControllerSpec
impl Sync for ControllerSpec
impl Unpin for ControllerSpec
impl UnsafeUnpin for ControllerSpec
impl UnwindSafe for ControllerSpec
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<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