Enum ractor::rpc::call_result::CallResult
source · pub enum CallResult<TResult> {
Success(TResult),
Timeout,
SenderError,
}
Expand description
The result from a crate::rpc::call operation
Variants§
Success(TResult)
Success, with the result
Timeout
Timeout
SenderError
The transmission channel was dropped without any message(s) being sent
Implementations§
source§impl<T> CallResult<T>
impl<T> CallResult<T>
sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Determine if the CallResult is a CallResult::Success
sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Determine if the CallResult is a CallResult::Timeout
sourcepub fn is_send_error(&self) -> bool
pub fn is_send_error(&self) -> bool
Determine if the CallResult is a CallResult::SenderError
sourcepub fn unwrap(self) -> T
pub fn unwrap(self) -> T
Unwrap a CallResult, panicking on any non-success
sourcepub fn expect(self, msg: &'static str) -> T
pub fn expect(self, msg: &'static str) -> T
Unwrap a CallResult, panicking on non-succcess with the specified message
sourcepub fn unwrap_or(self, default: T) -> T
pub fn unwrap_or(self, default: T) -> T
Unwrap the CallResult or give a default value
sourcepub fn unwrap_or_else<F>(self, f: F) -> Twhere
F: FnOnce() -> T,
pub fn unwrap_or_else<F>(self, f: F) -> Twhere
F: FnOnce() -> T,
Returns the CallResult’s success result or computes the closure
sourcepub fn success_or<E>(self, err: E) -> Result<T, E>
pub fn success_or<E>(self, err: E) -> Result<T, E>
Transforms the CallResult to a Result mapping Success(t)
to Ok(t)
and all else to Err(err)
sourcepub fn success_or_else<E, F>(self, err: F) -> Result<T, E>where
F: FnOnce() -> E,
pub fn success_or_else<E, F>(self, err: F) -> Result<T, E>where
F: FnOnce() -> E,
Transforms the CallResult to a Result mapping Success(t)
to Ok(t)
and all else to Err(err())
sourcepub fn map<O, F>(self, mapping: F) -> CallResult<O>where
F: FnOnce(T) -> O,
pub fn map<O, F>(self, mapping: F) -> CallResult<O>where
F: FnOnce(T) -> O,
Maps the success value of the CallResult to another type
sourcepub fn map_or<O, F>(self, default: O, mapping: F) -> Owhere
F: FnOnce(T) -> O,
pub fn map_or<O, F>(self, default: O, mapping: F) -> Owhere
F: FnOnce(T) -> O,
Maps the success value of the CallResult to another type or returns the default value
sourcepub fn map_or_else<D, O, F>(self, default: D, mapping: F) -> O
pub fn map_or_else<D, O, F>(self, default: D, mapping: F) -> O
Maps the success value of the CallResult to another type or returns the default function result
Trait Implementations§
source§impl<TResult: Debug> Debug for CallResult<TResult>
impl<TResult: Debug> Debug for CallResult<TResult>
source§impl<T, TResult> From<CallResult<TResult>> for RactorErr<T>
impl<T, TResult> From<CallResult<TResult>> for RactorErr<T>
source§fn from(value: CallResult<TResult>) -> Self
fn from(value: CallResult<TResult>) -> Self
source§impl<TResult: PartialEq> PartialEq for CallResult<TResult>
impl<TResult: PartialEq> PartialEq for CallResult<TResult>
source§fn eq(&self, other: &CallResult<TResult>) -> bool
fn eq(&self, other: &CallResult<TResult>) -> bool
self
and other
values to be equal, and is used
by ==
.