pub struct Oneshot<I, O>(/* private fields */);Expand description
Invoke and Accept implementation in terms of a single stream pair.
Either Invoke::invoke or Accept::accept can only be called at most once
on Oneshot, repeated calls with return an error
Implementations§
Source§impl Oneshot<ReadHalf<DuplexStream>, WriteHalf<DuplexStream>>
impl Oneshot<ReadHalf<DuplexStream>, WriteHalf<DuplexStream>>
Sourcepub fn duplex(max_buf_size: usize) -> (Self, Self)
pub fn duplex(max_buf_size: usize) -> (Self, Self)
Creates a pair of connected Oneshot using tokio::io::duplex.
Source§impl<I, O> Oneshot<I, O>
impl<I, O> Oneshot<I, O>
Sourcepub fn try_take_inner(&self) -> Result<(I, O)>
pub fn try_take_inner(&self) -> Result<(I, O)>
Returns the inner stream pair if Oneshot has not been used yet or an error.
Trait Implementations§
Source§impl From<DuplexStream> for Oneshot<ReadHalf<DuplexStream>, WriteHalf<DuplexStream>>
impl From<DuplexStream> for Oneshot<ReadHalf<DuplexStream>, WriteHalf<DuplexStream>>
Source§fn from(stream: DuplexStream) -> Self
fn from(stream: DuplexStream) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<I, O> !Freeze for Oneshot<I, O>
impl<I, O> RefUnwindSafe for Oneshot<I, O>
impl<I, O> Send for Oneshot<I, O>
impl<I, O> Sync for Oneshot<I, O>
impl<I, O> Unpin for Oneshot<I, O>
impl<I, O> UnwindSafe for Oneshot<I, O>
Blanket Implementations§
Source§impl<T> AcceptExt for Twhere
T: Accept,
impl<T> AcceptExt for Twhere
T: Accept,
Source§fn map_context<T, F: Fn(Self::Context) -> T>(
self,
f: F,
) -> AcceptMapContext<Self, F>
fn map_context<T, F: Fn(Self::Context) -> T>( self, f: F, ) -> AcceptMapContext<Self, F>
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> InvokeExt for Twhere
T: Invoke,
impl<T> InvokeExt for Twhere
T: Invoke,
Source§fn invoke_values<P, Params, Results>(
&self,
cx: Self::Context,
instance: &str,
func: &str,
params: Params,
paths: impl AsRef<[P]> + Send,
) -> impl Future<Output = Result<(Results, Option<impl Future<Output = Result<()>> + Send + 'static>)>> + Send
fn invoke_values<P, Params, Results>( &self, cx: Self::Context, instance: &str, func: &str, params: Params, paths: impl AsRef<[P]> + Send, ) -> impl Future<Output = Result<(Results, Option<impl Future<Output = Result<()>> + Send + 'static>)>> + Send
Invoke function
func on instance instance using typed Params and ResultsSource§fn invoke_values_blocking<P, Params, Results>(
&self,
cx: Self::Context,
instance: &str,
func: &str,
params: Params,
paths: impl AsRef<[P]> + Send,
) -> impl Future<Output = Result<Results>> + Send
fn invoke_values_blocking<P, Params, Results>( &self, cx: Self::Context, instance: &str, func: &str, params: Params, paths: impl AsRef<[P]> + Send, ) -> impl Future<Output = Result<Results>> + Send
Invoke function
func on instance instance using typed Params and Results
This is like Self::invoke_values, but it only results once all I/O is doneSource§fn timeout(&self, timeout: Duration) -> Timeout<'_, Self>
fn timeout(&self, timeout: Duration) -> Timeout<'_, Self>
Returns a
Timeout, wrapping Self with an implementation of Invoke, which will
error, if call to Invoke::invoke does not return within a supplied timeout