ServiceHandle

Struct ServiceHandle 

Source
pub struct ServiceHandle<R, P>
where R: Send + 'static, P: Send + Clone + 'static,
{ /* private fields */ }

Implementations§

Source§

impl<R, P> ServiceHandle<R, P>
where R: Send + 'static, P: Send + Clone + 'static,

Source

pub fn hooks<F>(self, f: F) -> Self
where F: FnOnce(&mut ServiceHooks<R, P>),

Source

pub fn inner(&self) -> &Arc<dyn DogService<R, P>>

Source§

impl<R, P> ServiceHandle<R, P>
where R: Send + 'static, P: Send + Clone + 'static,

Source

pub fn on(&self, event: ServiceEventKind, listener: EventListener<R, P>)

app.service(“messages”)?.on(ServiceEventKind::Created, Arc::new(|data, ctx| { /* … */ }));

Source

pub fn on_str(&self, event: &str, listener: EventListener<R, P>) -> Result<()>

Source§

impl<R, P> ServiceHandle<R, P>
where R: Send + 'static, P: Send + Clone + 'static,

Source

pub async fn find(&self, tenant: TenantContext, params: P) -> Result<Vec<R>>

Source

pub async fn get(&self, tenant: TenantContext, id: &str, params: P) -> Result<R>

Source

pub async fn create( &self, tenant: TenantContext, data: R, params: P, ) -> Result<R>

Source

pub async fn patch( &self, tenant: TenantContext, id: Option<&str>, data: R, params: P, ) -> Result<R>

Source

pub async fn update( &self, tenant: TenantContext, id: &str, data: R, params: P, ) -> Result<R>

Source

pub async fn remove( &self, tenant: TenantContext, id: Option<&str>, params: P, ) -> Result<R>

Source

pub async fn custom( &self, tenant: TenantContext, method: &'static str, data: Option<R>, params: P, ) -> Result<R>

Custom method that goes through the full dogrs pipeline (hooks, events, etc.)

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<R, P> !UnwindSafe for ServiceHandle<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.