pub enum PoloniusResult<BorrowingOutput, OwnedOutput, InputBorrow = Placeholder> {
    Borrowing(BorrowingOutput),
    Owned {
        value: OwnedOutput,
        input_borrow: InputBorrow,
    },
}
Expand description

Output type of both the polonius() function and the closure it takes.

It represents the conceptual code-flow / branch disjunction between:

  • having some dependent type still Borrowing from the input_borrow given/forfeited to polonius();

  • or having no such type, i.e., having only “Owned” (as far as the input_borrow is concerned) output.

    • polonius() magic makes it so, in this branch/case, its .input_borrow shall be populated for the caller to get back access to it.

Variants§

§

Borrowing(BorrowingOutput)

Variant to return in the “happy” case where our tentative (re)borrow actually yielded some dependent / still-Borrowing type which we wish to keep hold of, e.g., to return it from the function.

§

Owned

Fields

§value: OwnedOutput

The inner value of the Self::Owned(value) case.

§input_borrow: InputBorrow

When constructing this variant, inside polonius()’ closure, a Placeholder is to be put in its stead, to let polonius() replace it with its input_borrow.

Variant to return in the branches where we are done with any dependent value, and we would like to instead get our input_borrow back.

Implementations§

source§

impl<BorrowingOutput, OwnedOutput> PoloniusResult<BorrowingOutput, OwnedOutput>

source

pub const fn Owned(value: OwnedOutput) -> Self

Tuple-variant-looking sugar to construct the Self::Owned variant.

It’s just convenience sugar for Self::Owned { value, input_borrow: Placeholder }.

PoloniusResult::Owned(42)
// is the same as:
PoloniusResult::Owned {
    value: 42,
    input_borrow: Placeholder,
}

See Placeholder for more info.

Auto Trait Implementations§

§

impl<BorrowingOutput, OwnedOutput, InputBorrow> RefUnwindSafe for PoloniusResult<BorrowingOutput, OwnedOutput, InputBorrow>
where BorrowingOutput: RefUnwindSafe, InputBorrow: RefUnwindSafe, OwnedOutput: RefUnwindSafe,

§

impl<BorrowingOutput, OwnedOutput, InputBorrow> Send for PoloniusResult<BorrowingOutput, OwnedOutput, InputBorrow>
where BorrowingOutput: Send, InputBorrow: Send, OwnedOutput: Send,

§

impl<BorrowingOutput, OwnedOutput, InputBorrow> Sync for PoloniusResult<BorrowingOutput, OwnedOutput, InputBorrow>
where BorrowingOutput: Sync, InputBorrow: Sync, OwnedOutput: Sync,

§

impl<BorrowingOutput, OwnedOutput, InputBorrow> Unpin for PoloniusResult<BorrowingOutput, OwnedOutput, InputBorrow>
where BorrowingOutput: Unpin, InputBorrow: Unpin, OwnedOutput: Unpin,

§

impl<BorrowingOutput, OwnedOutput, InputBorrow> UnwindSafe for PoloniusResult<BorrowingOutput, OwnedOutput, InputBorrow>
where BorrowingOutput: UnwindSafe, InputBorrow: UnwindSafe, OwnedOutput: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Is for T
where T: ?Sized,

§

type EqTo = T

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.