Struct NeverShortCircuit

#[repr(transparent)]
pub(crate) struct NeverShortCircuit<T>(pub T);

An adapter for implementing non-try methods via the Try implementation.

Conceptually the same as Result<T, !>, but requiring less work in trait solving and inhabited-ness checking and such, by being an obvious newtype and not having From bounds lying around.

Not currently planned to be exposed publicly, so just pub(crate).

Fields

0: T

Implementations

impl<T> NeverShortCircuit<T>

const fn wrap_mut_1<A, F>(f: F) -> impl ~const FnMut(A) -> Self
where
    F: ~const FnMut(A) -> T,

Wraps a unary function to produce one that wraps the output into a NeverShortCircuit.

This is useful for implementing infallible functions in terms of the try_ ones, without accidentally capturing extra generic parameters in a closure.

const fn wrap_mut_2<A, B, F>(f: F) -> impl ~const FnMut(A, B) -> Self
where
    F: ~const FnMut(A, B) -> T,

Trait Implementations

impl<T> FromResidual for NeverShortCircuit<T>

fn from_residual(never: NeverShortCircuitResidual) -> Self

impl<T> Try for NeverShortCircuit<T>

type Output = T;
type Residual = NeverShortCircuitResidual;
fn branch(self) -> ControlFlow<NeverShortCircuitResidual, T>
fn from_output(x: T) -> Self

Auto Trait Implementations

impl<T> Freeze for NeverShortCircuit<T> where T: Freeze,

impl<T> RefUnwindSafe for NeverShortCircuit<T> where T: RefUnwindSafe,

impl<T> Send for NeverShortCircuit<T> where T: Send,

impl<T> Sync for NeverShortCircuit<T> where T: Sync,

impl<T> Unpin for NeverShortCircuit<T> where T: Unpin,

impl<T> UnsafeUnpin for NeverShortCircuit<T> where T: UnsafeUnpin,

impl<T> UnwindSafe for NeverShortCircuit<T> where T: UnwindSafe,

Blanket Implementations

impl<T> Any for NeverShortCircuit<T> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for NeverShortCircuit<T> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for NeverShortCircuit<T> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for NeverShortCircuit<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for NeverShortCircuit<T> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for NeverShortCircuit<T>

impl<T, U> Into<U> for NeverShortCircuit<T> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for NeverShortCircuit<T> where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for NeverShortCircuit<T> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>