Struct iterr::Trap [−][src]
#[must_use]pub struct Trap<E> { /* fields omitted */ }
A trap used for a call to ItErr::lift_err
.
Traps are "armed" unless they are consumed. If an armed trap is dropped in a debug build, a panic will be raised.
Methods
impl<E> Trap<E>
[src]
impl<E> Trap<E>
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates a new, empty but armed trap.
pub fn and<T>(self, res: Result<T, E>) -> Result<T, E>
[src]
pub fn and<T>(self, res: Result<T, E>) -> Result<T, E>
Disarms and consumes the trap, turning it into a Result<T, E>
by combining it with another Result<T, E>
.
pub fn and_ok<T>(self, res: T) -> Result<T, E>
[src]
pub fn and_ok<T>(self, res: T) -> Result<T, E>
Disarms and consumes the trap, turning it into a Result<T, E>
by combining it with a value.
pub fn and_then<O, T>(self, op: O) -> Result<T, E> where
O: FnOnce() -> Result<T, E>,
[src]
pub fn and_then<O, T>(self, op: O) -> Result<T, E> where
O: FnOnce() -> Result<T, E>,
Disarms and consumes the trap, turning it into a Result<T, E>
by combining it with another Result<T, E>
.
op
is called if and only if the trap does not contain an error.
pub fn and_then_ok<O, T>(self, op: O) -> Result<T, E> where
O: FnOnce() -> T,
[src]
pub fn and_then_ok<O, T>(self, op: O) -> Result<T, E> where
O: FnOnce() -> T,
Disarms and consumes the trap, turning it into a Result<T, E>
by combining it with a value.
op
is called if and only if the trap does not contain an error.
pub fn into_result(self) -> Result<(), E>
[src]
pub fn into_result(self) -> Result<(), E>
Disarms and consumes the trap, turning it into a Result<(), E>
.
The result of this method should either be propogated with ?
, or combined with an Ok(v)
using Result::and
or Result::and_then
.