[][src]Struct rustbus::connection::dispatch_conn::DispatchConn

pub struct DispatchConn<HandlerCtx, HandlerError: Debug> { /* fields omitted */ }

Implementations

impl<UserData, UserError: Debug> DispatchConn<UserData, UserError>[src]

pub fn new(
    conn: DuplexConn,
    ctx: UserData,
    default_handler: Box<HandleFn<UserData, UserError>>
) -> Self
[src]

pub fn add_handler(
    &mut self,
    path: &str,
    handler: Box<HandleFn<UserData, UserError>>
)
[src]

pub fn run(
    &mut self
) -> Result<(), (Option<MarshalledMessage>, HandleError<UserError>)>
[src]

Endless loop that takes messages and dispatches them to the setup handlers. If any errors occur they will be returned. Depending on the error you may choose to just call this function again. Note that you are expected to send a meaningful error message. The offending message will be returned alongside the error.

This also sends reponses back to the callers, returned by the handlers. If the handlers did return None, it sends a default response with no content.

Auto Trait Implementations

impl<HandlerCtx, HandlerError> !RefUnwindSafe for DispatchConn<HandlerCtx, HandlerError>[src]

impl<HandlerCtx, HandlerError> !Send for DispatchConn<HandlerCtx, HandlerError>[src]

impl<HandlerCtx, HandlerError> !Sync for DispatchConn<HandlerCtx, HandlerError>[src]

impl<HandlerCtx, HandlerError> Unpin for DispatchConn<HandlerCtx, HandlerError> where
    HandlerCtx: Unpin
[src]

impl<HandlerCtx, HandlerError> !UnwindSafe for DispatchConn<HandlerCtx, HandlerError>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.