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>
impl<'tcx, T> InterpResult_<'tcx, T>
fn new(res: Result<T, InterpErrorInfo<'tcx>>) -> Self
fn disarm(self) -> Result<T, InterpErrorInfo<'tcx>>
Sourcepub fn discard_err(self) -> Option<T>
pub fn discard_err(self) -> Option<T>
Discard the error information in this result. Only use this if ignoring Undefined Behavior is okay!
Sourcepub fn report_err(self) -> Result<T, InterpErrorInfo<'tcx>>
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!
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> InterpResult<'tcx, U>
pub fn map_err_info( self, f: impl FnOnce(InterpErrorInfo<'tcx>) -> InterpErrorInfo<'tcx>, ) -> InterpResult<'tcx, T>
pub fn map_err_kind( self, f: impl FnOnce(InterpErrorKind<'tcx>) -> InterpErrorKind<'tcx>, ) -> InterpResult<'tcx, T>
pub fn inspect_err_kind( self, f: impl FnOnce(&InterpErrorKind<'tcx>), ) -> InterpResult<'tcx, T>
pub fn unwrap(self) -> T
pub fn unwrap_or_else(self, f: impl FnOnce(InterpErrorInfo<'tcx>) -> T) -> T
pub fn expect(self, msg: &str) -> T
pub fn and_then<U>( self, f: impl FnOnce(T) -> InterpResult<'tcx, U>, ) -> InterpResult<'tcx, U>
Sourcepub fn and<U>(self, other: InterpResult<'tcx, U>) -> InterpResult<'tcx, (T, U)>
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>
impl<'tcx, T, E: Into<InterpErrorInfo<'tcx>>> From<Result<T, E>> for InterpResult<'tcx, T>
Source§impl<'tcx, T, V: FromIterator<T>> FromIterator<InterpResult_<'tcx, T>> for InterpResult<'tcx, V>
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
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>
impl<'tcx, T: Debug> Debug for InterpResult_<'tcx, T>
Source§impl<'tcx, T, E: Into<InterpErrorInfo<'tcx>>> FromResidual<Result<Infallible, E>> for InterpResult_<'tcx, T>
impl<'tcx, T, E: Into<InterpErrorInfo<'tcx>>> FromResidual<Result<Infallible, E>> for InterpResult_<'tcx, T>
Source§fn from_residual(residual: Result<Infallible, E>) -> Self
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 moreSource§impl<'tcx, T> FromResidual<Yeet<InterpErrorKind<'tcx>>> for InterpResult_<'tcx, T>
impl<'tcx, T> FromResidual<Yeet<InterpErrorKind<'tcx>>> for InterpResult_<'tcx, T>
Source§fn from_residual(ops::Yeet: Yeet<InterpErrorKind<'tcx>>) -> Self
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 moreSource§impl<'tcx, T> FromResidual for InterpResult_<'tcx, T>
impl<'tcx, T> FromResidual for InterpResult_<'tcx, T>
Source§fn from_residual(residual: InterpResult_<'tcx, Infallible>) -> Self
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 moreSource§impl<'tcx, T> Try for InterpResult_<'tcx, T>
impl<'tcx, T> Try for InterpResult_<'tcx, T>
Source§type Output = T
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>
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 moreSource§fn from_output(output: Self::Output) -> Self
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 moreSource§fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
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 moreLayout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.