pub struct HttpExchange { /* private fields */ }Expand description
The exchange handed to a session’s PeerSession.
Holds the table it records into and the stream it writes to. Two handles to one session, kept together so a request and the answer that completes it cannot end up on different sessions.
Implementations§
Source§impl HttpExchange
impl HttpExchange
Sourcepub fn new(table: ExchangeTable, tail: EventTail<Value>) -> Self
pub fn new(table: ExchangeTable, tail: EventTail<Value>) -> Self
An exchange publishing into tail and recording into table.
Sourcepub fn publishing(
table: ExchangeTable,
publish: impl Fn(Value) + Send + Sync + 'static,
) -> Self
pub fn publishing( table: ExchangeTable, publish: impl Fn(Value) + Send + Sync + 'static, ) -> Self
An exchange that hands each request to publish and records into
table.
Sourcepub const fn table(&self) -> &ExchangeTable
pub const fn table(&self) -> &ExchangeTable
The table this session’s answers are routed back through.
Trait Implementations§
Source§impl CallbackExchange for HttpExchange
impl CallbackExchange for HttpExchange
Source§async fn exchange(
&self,
method: &str,
params: &JsonObject,
) -> Result<JsonObject, ExchangeError>
async fn exchange( &self, method: &str, params: &JsonObject, ) -> Result<JsonObject, ExchangeError>
Publishes a server-initiated request and waits for its answer.
The wait is the part a POST-shaped transport makes awkward: the
request goes out on the stream the current request opened, and the
answer comes back on a later POST this future does not own. The table
is the rendezvous — this side parks on a oneshot, and
ExchangeTable::resolve completes it from whichever task happens to be
reading the peer’s next request.
Source§impl Clone for HttpExchange
impl Clone for HttpExchange
Auto Trait Implementations§
impl !RefUnwindSafe for HttpExchange
impl !UnwindSafe for HttpExchange
impl Freeze for HttpExchange
impl Send for HttpExchange
impl Sync for HttpExchange
impl Unpin for HttpExchange
impl UnsafeUnpin for HttpExchange
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DynExchange for T
impl<T> DynExchange for T
Source§fn exchange_boxed<'a>(
&'a self,
method: &'a str,
params: &'a JsonObject,
) -> Pin<Box<dyn Future<Output = Result<JsonObject, ExchangeError>> + Send + 'a>>
fn exchange_boxed<'a>( &'a self, method: &'a str, params: &'a JsonObject, ) -> Pin<Box<dyn Future<Output = Result<JsonObject, ExchangeError>> + Send + 'a>>
CallbackExchange::exchange. Read more