[−][src]Struct edelcrantz::Connection
Fields
queue: Queue<OneWay, Request, Response>
Implementations
impl<OneWay: Msg, Request: Msg, Response: Msg> Connection<OneWay, Request, Response>
[src]
A connection encapsulates logic for sending and receiving a particular vocabulary of messages: one-way messages, requests, and responses. The message types may be different or all the same, and may have internal structure or be enums that have further meaning to the caller: all the connection knows is that messages of the request type will be responded-to by messages of the response type, and messages of the one-way type will not be responded to.
pub fn new<RW: AsyncReadWrite>(rw: RW) -> Self
[src]
pub fn enqueue_oneway(
&self,
oneway: OneWay
) -> impl Future<Output = Result<(), Error>> + 'static
[src]
&self,
oneway: OneWay
) -> impl Future<Output = Result<(), Error>> + 'static
Just calls self.queue.enqueue_oneway
.
pub fn enqueue_request(
&self,
req: Request
) -> impl Future<Output = Result<Response, Error>> + 'static
[src]
&self,
req: Request
) -> impl Future<Output = Result<Response, Error>> + 'static
Just calls self.queue.enqueue_request
.
pub async fn advance<ServeRequest, FutureResponse, ServeOneWay, '_>(
&'_ mut self,
srv_req: ServeRequest,
srv_ow: ServeOneWay
) -> Result<(), Error> where
ServeRequest: FnOnce(Request) -> FutureResponse,
FutureResponse: Future<Output = Response> + Send + 'static,
ServeOneWay: FnOnce(OneWay),
[src]
&'_ mut self,
srv_req: ServeRequest,
srv_ow: ServeOneWay
) -> Result<(), Error> where
ServeRequest: FnOnce(Request) -> FutureResponse,
FutureResponse: Future<Output = Response> + Send + 'static,
ServeOneWay: FnOnce(OneWay),
Take the next available step on this connection. Either:
- Sending an enqueued envelope.
- Resolving and enqueueing the output of a request's service routine future.
- Receiving an envelope and transferring it to either a service routine or a response future created by Connection::enqueue_request.
Callers should supply a srv_req
function to service request envelopes
by issuing futures, and a srv_ow
function to service one-way
envelopes.
Auto Trait Implementations
impl<OneWay, Request, Response> !RefUnwindSafe for Connection<OneWay, Request, Response>
impl<OneWay, Request, Response> Send for Connection<OneWay, Request, Response>
impl<OneWay, Request, Response> !Sync for Connection<OneWay, Request, Response>
impl<OneWay, Request, Response> Unpin for Connection<OneWay, Request, Response>
impl<OneWay, Request, Response> !UnwindSafe for Connection<OneWay, Request, Response>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,