Struct kitsune_p2p_types::KitsuneTimeout
source · pub struct KitsuneTimeout(_);
Expand description
Kitsune Timeout
Implementations§
source§impl KitsuneTimeout
impl KitsuneTimeout
sourcepub fn from_millis(millis: u64) -> Self
pub fn from_millis(millis: u64) -> Self
Convenience fn to create a new timeout for an amount of milliseconds.
sourcepub fn backoff(&self, initial_ms: u64, max_ms: u64) -> KitsuneBackoff
pub fn backoff(&self, initial_ms: u64, max_ms: u64) -> KitsuneBackoff
Generate a backoff instance bound to this timeout
sourcepub fn time_remaining(&self) -> Duration
pub fn time_remaining(&self) -> Duration
Get Duration until timeout expires.
sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Has this timeout expired?
sourcepub fn ok(&self, ctx: &str) -> KitsuneResult<()>
pub fn ok(&self, ctx: &str) -> KitsuneResult<()>
Ok(())
if not expired, Err(KitsuneError::TimedOut)
if expired.
sourcepub fn mix<'a, 'b, R, F>(
&'a self,
ctx: &str,
f: F
) -> impl Future<Output = KitsuneResult<R>> + 'b + Sendwhere
R: 'b,
F: Future<Output = KitsuneResult<R>> + 'b + Send,
pub fn mix<'a, 'b, R, F>( &'a self, ctx: &str, f: F ) -> impl Future<Output = KitsuneResult<R>> + 'b + Sendwhere R: 'b, F: Future<Output = KitsuneResult<R>> + 'b + Send,
Wrap a future with one that will timeout when this timeout expires.
Trait Implementations§
source§impl Clone for KitsuneTimeout
impl Clone for KitsuneTimeout
source§fn clone(&self) -> KitsuneTimeout
fn clone(&self) -> KitsuneTimeout
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for KitsuneTimeout
impl Debug for KitsuneTimeout
impl Copy for KitsuneTimeout
Auto Trait Implementations§
impl RefUnwindSafe for KitsuneTimeout
impl Send for KitsuneTimeout
impl Sync for KitsuneTimeout
impl Unpin for KitsuneTimeout
impl UnwindSafe for KitsuneTimeout
Blanket Implementations§
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> 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>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.