pub struct Interface<Ops>where
Ops: OpsT,{ /* private fields */ }Expand description
Collection of server-side notification handlers
Implementations§
Source§impl<Ops> Interface<Ops>where
Ops: OpsT,
impl<Ops> Interface<Ops>where
Ops: OpsT,
Sourcepub fn notification<Msg>(&mut self, op: Ops, method: Notification<Msg>)
pub fn notification<Msg>(&mut self, op: Ops, method: Notification<Msg>)
Register a notification handler for the given operation. Panics if a
handler for the same op has already been registered.
Sourcepub async fn call_notification_with_borsh(
&self,
op: &Ops,
payload: &[u8],
) -> ServerResult<()>
pub async fn call_notification_with_borsh( &self, op: &Ops, payload: &[u8], ) -> ServerResult<()>
Dispatch a Borsh-encoded notification payload to the handler registered
for op, returning ServerError::NotFound if none exists.
Sourcepub async fn call_notification_with_serde_json(
&self,
op: &Ops,
payload: Value,
) -> ServerResult<()>
pub async fn call_notification_with_serde_json( &self, op: &Ops, payload: Value, ) -> ServerResult<()>
Dispatch a JSON notification payload to the handler registered for op,
returning ServerError::NotFound if none exists.
Trait Implementations§
Auto Trait Implementations§
impl<Ops> !RefUnwindSafe for Interface<Ops>
impl<Ops> !UnwindSafe for Interface<Ops>
impl<Ops> Freeze for Interface<Ops>
impl<Ops> Send for Interface<Ops>
impl<Ops> Sync for Interface<Ops>
impl<Ops> Unpin for Interface<Ops>where
Ops: Unpin,
impl<Ops> UnsafeUnpin for Interface<Ops>
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.