Struct jupiter::commands::Call[][src]

pub struct Call {
    pub request: Request,
    pub response: Response,
    pub token: usize,
    // some fields omitted
}

Represents the invocation of a command.

This wraps the request, a pre-initialized result and the command index (token) in a single struct which is then sent to the actor executing the command using a queue. It also contains the callback which is another (oneshot) queue to send back the result - however this is completely handled internally, therefore only complete has to be called for this call to finish processing a command.

Fields

request: Request

Contains the request as sent by the client.

response: Response

Contains the response to be filled with the response data

token: usize

Contains the index of the commend being called.

This is required as commonly a bunch of commands share a single queue, so that the invocation of these commands is “single threaded” from the view of the actor.

Implementations

impl Call[src]

pub fn complete(self, result: CommandResult)[src]

Marks the command represented by this call as handled.

In case of a successful completion, this simply closes the response and sends the serialized data back to the caller. In case of an error, an appropriate representation is generated and sent back as alternative response. However, in case of an OutputError, we directly send error back to the caller, as the connection might be in an inconsistent state. The caller then will most probably try to write an error and then close the connection to prevent any further inconsistencies.

pub fn handle_unknown_token(self)[src]

Handles an unknown token by completing with an appropriate error.

Auto Trait Implementations

impl !RefUnwindSafe for Call

impl Send for Call

impl Sync for Call

impl Unpin for Call

impl !UnwindSafe for Call

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> Instrument for T[src]

impl<T> Instrument 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.