[−][src]Struct edelcrantz::Connection
Fields
queue: Queue<OneWay, Request, Response>
A queue that can be cloned out of the Connection and used to submit work without having exclusive ownership of the Connection.
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_split<R, W>(rdr: R, wtr: W) -> Self where
R: AsyncRead + Unpin + Send + Sync + 'static,
W: AsyncWrite + Unpin + Send + Sync + 'static,
[src]
R: AsyncRead + Unpin + Send + Sync + 'static,
W: AsyncWrite + Unpin + Send + Sync + 'static,
Construct a new Connection from a separate AsyncRead and AsyncWrite pair;
in some cases this will perform better than passing a merged AsyncRead+AsyncWrite
and having it split (which we do in new
below).
pub fn new<RW: AsyncReadWrite>(rw: RW) -> Self
[src]
Construct a new Connection from an AsyncRead+AsyncWrite value, splitting
it and passing the read and write parts to new_split
.
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>
[src]
impl<OneWay, Request, Response> Send for Connection<OneWay, Request, Response>
[src]
impl<OneWay, Request, Response> !Sync for Connection<OneWay, Request, Response>
[src]
impl<OneWay, Request, Response> Unpin for Connection<OneWay, Request, Response>
[src]
impl<OneWay, Request, Response> !UnwindSafe for Connection<OneWay, Request, Response>
[src]
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> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,