ServiceHooks

Struct ServiceHooks 

Source
pub struct ServiceHooks<R, P> {
    pub around_all: Vec<Arc<dyn DogAroundHook<R, P>>>,
    pub before_all: Vec<Arc<dyn DogBeforeHook<R, P>>>,
    pub after_all: Vec<Arc<dyn DogAfterHook<R, P>>>,
    pub error_all: Vec<Arc<dyn DogErrorHook<R, P>>>,
    pub around_by_method: HashMap<ServiceMethodKind, Vec<Arc<dyn DogAroundHook<R, P>>>>,
    pub before_by_method: HashMap<ServiceMethodKind, Vec<Arc<dyn DogBeforeHook<R, P>>>>,
    pub after_by_method: HashMap<ServiceMethodKind, Vec<Arc<dyn DogAfterHook<R, P>>>>,
    pub error_by_method: HashMap<ServiceMethodKind, Vec<Arc<dyn DogErrorHook<R, P>>>>,
}
Expand description

Feathers-style hooks container:

{ around: { all, create, find }, before: { all, create }, after: { all, find }, error: { all, create } }

Fields§

§around_all: Vec<Arc<dyn DogAroundHook<R, P>>>§before_all: Vec<Arc<dyn DogBeforeHook<R, P>>>§after_all: Vec<Arc<dyn DogAfterHook<R, P>>>§error_all: Vec<Arc<dyn DogErrorHook<R, P>>>§around_by_method: HashMap<ServiceMethodKind, Vec<Arc<dyn DogAroundHook<R, P>>>>§before_by_method: HashMap<ServiceMethodKind, Vec<Arc<dyn DogBeforeHook<R, P>>>>§after_by_method: HashMap<ServiceMethodKind, Vec<Arc<dyn DogAfterHook<R, P>>>>§error_by_method: HashMap<ServiceMethodKind, Vec<Arc<dyn DogErrorHook<R, P>>>>

Implementations§

Source§

impl<R, P> ServiceHooks<R, P>

Source

pub fn new() -> Self

Source

pub fn is_empty(&self) -> bool

Source

pub fn around_all(&mut self, hook: Arc<dyn DogAroundHook<R, P>>) -> &mut Self

Source

pub fn around( &mut self, method: ServiceMethodKind, hook: Arc<dyn DogAroundHook<R, P>>, ) -> &mut Self

Source

pub fn before_all(&mut self, hook: Arc<dyn DogBeforeHook<R, P>>) -> &mut Self

Source

pub fn before( &mut self, method: ServiceMethodKind, hook: Arc<dyn DogBeforeHook<R, P>>, ) -> &mut Self

Source

pub fn before_create(&mut self, hook: Arc<dyn DogBeforeHook<R, P>>) -> &mut Self

Source

pub fn before_find(&mut self, hook: Arc<dyn DogBeforeHook<R, P>>) -> &mut Self

Source

pub fn before_get(&mut self, hook: Arc<dyn DogBeforeHook<R, P>>) -> &mut Self

Source

pub fn before_update(&mut self, hook: Arc<dyn DogBeforeHook<R, P>>) -> &mut Self

Source

pub fn before_patch(&mut self, hook: Arc<dyn DogBeforeHook<R, P>>) -> &mut Self

Source

pub fn before_remove(&mut self, hook: Arc<dyn DogBeforeHook<R, P>>) -> &mut Self

Source

pub fn after_all(&mut self, hook: Arc<dyn DogAfterHook<R, P>>) -> &mut Self

Source

pub fn after( &mut self, method: ServiceMethodKind, hook: Arc<dyn DogAfterHook<R, P>>, ) -> &mut Self

Source

pub fn after_create(&mut self, hook: Arc<dyn DogAfterHook<R, P>>) -> &mut Self

Source

pub fn after_find(&mut self, hook: Arc<dyn DogAfterHook<R, P>>) -> &mut Self

Source

pub fn error_all(&mut self, hook: Arc<dyn DogErrorHook<R, P>>) -> &mut Self

Source

pub fn error( &mut self, method: ServiceMethodKind, hook: Arc<dyn DogErrorHook<R, P>>, ) -> &mut Self

Trait Implementations§

Source§

impl<R, P> Default for ServiceHooks<R, P>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<R, P> SchemaHooksExt<R, P> for ServiceHooks<R, P>
where R: Send + 'static, P: Send + Clone + 'static,

Source§

fn schema<F>(&mut self, f: F) -> &mut Self
where F: FnOnce(&mut SchemaBuilder<'_, R, P>),

Auto Trait Implementations§

§

impl<R, P> Freeze for ServiceHooks<R, P>

§

impl<R, P> !RefUnwindSafe for ServiceHooks<R, P>

§

impl<R, P> Send for ServiceHooks<R, P>

§

impl<R, P> Sync for ServiceHooks<R, P>

§

impl<R, P> Unpin for ServiceHooks<R, P>

§

impl<R, P> !UnwindSafe for ServiceHooks<R, P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.