Type Alias InterpResult

Source
pub type InterpResult<'tcx, T = ()> = InterpResult_<'tcx, T>;

Aliased Type§

struct InterpResult<'tcx, T = ()> {
    res: Result<T, InterpErrorInfo<'tcx>>,
    guard: Guard,
}

Fields§

§res: Result<T, InterpErrorInfo<'tcx>>§guard: Guard

Implementations

Source§

impl<'tcx, T> InterpResult_<'tcx, T>

Source

fn new(res: Result<T, InterpErrorInfo<'tcx>>) -> Self

Source

fn disarm(self) -> Result<T, InterpErrorInfo<'tcx>>

Source

pub fn discard_err(self) -> Option<T>

Discard the error information in this result. Only use this if ignoring Undefined Behavior is okay!

Source

pub fn report_err(self) -> Result<T, InterpErrorInfo<'tcx>>

Look at the Result wrapped inside of this. Must only be used to report the error!

Source

pub fn map<U>(self, f: impl FnOnce(T) -> U) -> InterpResult<'tcx, U>

Source

pub fn map_err_info( self, f: impl FnOnce(InterpErrorInfo<'tcx>) -> InterpErrorInfo<'tcx>, ) -> InterpResult<'tcx, T>

Source

pub fn map_err_kind( self, f: impl FnOnce(InterpErrorKind<'tcx>) -> InterpErrorKind<'tcx>, ) -> InterpResult<'tcx, T>

Source

pub fn inspect_err_kind( self, f: impl FnOnce(&InterpErrorKind<'tcx>), ) -> InterpResult<'tcx, T>

Source

pub fn unwrap(self) -> T

Source

pub fn unwrap_or_else(self, f: impl FnOnce(InterpErrorInfo<'tcx>) -> T) -> T

Source

pub fn expect(self, msg: &str) -> T

Source

pub fn and_then<U>( self, f: impl FnOnce(T) -> InterpResult<'tcx, U>, ) -> InterpResult<'tcx, U>

Source

pub fn and<U>(self, other: InterpResult<'tcx, U>) -> InterpResult<'tcx, (T, U)>

Returns success if both self and other succeed, while ensuring we don’t accidentally drop an error.

If both are an error, self will be reported.

Trait Implementations§

Source§

impl<'tcx, T, E: Into<InterpErrorInfo<'tcx>>> From<Result<T, E>> for InterpResult<'tcx, T>

Source§

fn from(value: Result<T, E>) -> Self

Converts to this type from the input type.
Source§

impl<'tcx, T, V: FromIterator<T>> FromIterator<InterpResult_<'tcx, T>> for InterpResult<'tcx, V>

Source§

fn from_iter<I: IntoIterator<Item = InterpResult<'tcx, T>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'tcx, T: Debug> Debug for InterpResult_<'tcx, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'tcx, T, E: Into<InterpErrorInfo<'tcx>>> FromResidual<Result<Infallible, E>> for InterpResult_<'tcx, T>

Source§

fn from_residual(residual: Result<Infallible, E>) -> Self

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
Source§

impl<'tcx, T> FromResidual<Yeet<InterpErrorKind<'tcx>>> for InterpResult_<'tcx, T>

Source§

fn from_residual(ops::Yeet: Yeet<InterpErrorKind<'tcx>>) -> Self

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
Source§

impl<'tcx, T> FromResidual for InterpResult_<'tcx, T>

Source§

fn from_residual(residual: InterpResult_<'tcx, Infallible>) -> Self

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
Source§

impl<'tcx, T> Try for InterpResult_<'tcx, T>

Source§

type Output = T

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
Source§

type Residual = InterpResult_<'tcx, Infallible>

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value passed to FromResidual::from_residual as part of ? when short-circuiting. Read more
Source§

fn from_output(output: Self::Output) -> Self

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from its Output type. Read more
Source§

fn branch(self) -> ControlFlow<Self::Residual, Self::Output>

🔬This is a nightly-only experimental API. (try_trait_v2)
Used in ? to decide whether the operator should produce a value (because this returned ControlFlow::Continue) or propagate a value back to the caller (because this returned ControlFlow::Break). Read more

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.