pub struct Toolbox {
pub send_msg: RwLock<Arc<dyn Fn(ConnectionId, WsResponseValue) -> bool + Send + Sync>>,
}Fields§
§send_msg: RwLock<Arc<dyn Fn(ConnectionId, WsResponseValue) -> bool + Send + Sync>>Implementations§
Source§impl Toolbox
impl Toolbox
pub fn new() -> Arc<Self>
pub fn set_ws_states( &self, states: Arc<DashMap<ConnectionId, Arc<WsStreamState>>>, oneshot: bool, )
pub fn send_ws_msg( sender: &Sender<Message>, resp: WsResponseValue, oneshot: bool, )
pub fn send(&self, conn_id: ConnectionId, resp: WsResponseValue) -> bool
pub fn send_response(&self, ctx: &RequestContext, resp: impl Serialize)
pub fn send_internal_error( &self, ctx: &RequestContext, code: ErrorCode, err: Error, )
pub fn send_request_error( &self, ctx: &RequestContext, code: ErrorCode, err: impl Into<Value>, )
pub fn send_log( &self, ctx: &RequestContext, level: LogLevel, msg: impl Into<String>, )
pub fn encode_ws_response<Resp: Serialize>( ctx: RequestContext, resp: Result<Resp>, ) -> Option<WsResponseValue>
Auto Trait Implementations§
impl !Freeze for Toolbox
impl !RefUnwindSafe for Toolbox
impl Send for Toolbox
impl Sync for Toolbox
impl Unpin for Toolbox
impl !UnwindSafe for Toolbox
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> 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