pub struct PartialSuccess<T, F> {
pub value: T,
pub failure: Option<F>,
}
Expand description
A type that represents a partial success.
Fields§
§value: T
The value of the partial success.
failure: Option<F>
The failure of the partial success.
Implementations§
Source§impl<T, F> PartialSuccess<T, F>
impl<T, F> PartialSuccess<T, F>
Sourcepub fn new(value: T, failure: Option<F>) -> Self
pub fn new(value: T, failure: Option<F>) -> Self
Creates a new PartialSuccess<T, F>
with the given value and failure.
Sourcepub fn success(value: T) -> Self
pub fn success(value: T) -> Self
Creates a new PartialSuccess<T, F>
with the given value.
Sourcepub fn partial(value: T, failure: F) -> Self
pub fn partial(value: T, failure: F) -> Self
Creates a new PartialSuccess<T, F>
with the given value and failure.
Sourcepub fn has_failure(&self) -> bool
pub fn has_failure(&self) -> bool
Returns true
if the partial success has a failure.
Sourcepub fn to_result(self) -> Result<T, F>
pub fn to_result(self) -> Result<T, F>
Converts the partial success into a Result<T, F>
.
Sourcepub fn to_ok<E>(self) -> Result<T, E>
pub fn to_ok<E>(self) -> Result<T, E>
Converts the partial success into a Result<T, E>
, discarding the failure if any.
Trait Implementations§
Source§impl<T: Clone, F: Clone> Clone for PartialSuccess<T, F>
impl<T: Clone, F: Clone> Clone for PartialSuccess<T, F>
Source§fn clone(&self) -> PartialSuccess<T, F>
fn clone(&self) -> PartialSuccess<T, F>
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<T, F> From<PartialSuccess<T, F>> for Result<T, F>
impl<T, F> From<PartialSuccess<T, F>> for Result<T, F>
Source§fn from(partial: PartialSuccess<T, F>) -> Self
fn from(partial: PartialSuccess<T, F>) -> Self
Converts to this type from the input type.
Source§impl<T: Ord, F: Ord> Ord for PartialSuccess<T, F>
impl<T: Ord, F: Ord> Ord for PartialSuccess<T, F>
Source§fn cmp(&self, other: &PartialSuccess<T, F>) -> Ordering
fn cmp(&self, other: &PartialSuccess<T, F>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd, F: PartialOrd> PartialOrd for PartialSuccess<T, F>
impl<T: PartialOrd, F: PartialOrd> PartialOrd for PartialSuccess<T, F>
impl<T: Copy, F: Copy> Copy for PartialSuccess<T, F>
impl<T: Eq, F: Eq> Eq for PartialSuccess<T, F>
impl<T, F> StructuralPartialEq for PartialSuccess<T, F>
Auto Trait Implementations§
impl<T, F> Freeze for PartialSuccess<T, F>
impl<T, F> RefUnwindSafe for PartialSuccess<T, F>where
T: RefUnwindSafe,
F: RefUnwindSafe,
impl<T, F> Send for PartialSuccess<T, F>
impl<T, F> Sync for PartialSuccess<T, F>
impl<T, F> Unpin for PartialSuccess<T, F>
impl<T, F> UnwindSafe for PartialSuccess<T, F>where
T: UnwindSafe,
F: UnwindSafe,
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
Mutably borrows from an owned value. Read more