Skip to main content

ReceiverDomain

Struct ReceiverDomain 

Source
pub struct ReceiverDomain(/* private fields */);
Expand description

One evaluator’s nonreused receiver-construction namespace.

The owner keeps this capability private. Exhaustion declines provenance; it never reuses another owner’s identity or affects value semantics.

use dive_value::{Ctx, ReceiverDomain, Value, tlc};
if let Some(owner) = ReceiverDomain::new() {
    let tuple = owner.tuple(vec![Value::Int(1)], 7, true);
    let caught = tlc::equals(&tuple, &Value::FALSE, Ctx::tlc())
        .err().and_then(|error| error.receiver_failure());
    assert_eq!(caught.and_then(|failure| owner.recover(failure)), Some((7, true)));
}

Implementations§

Source§

impl ReceiverDomain

Source

pub fn new() -> Option<Self>

Creates an owner capability, or declines if its packed identity is exhausted.

Source

pub fn tuple(&self, values: Vec<Value>, node: u32, diagnostic: bool) -> Value

Builds an actual tuple constructor with this owner’s source-hook facts. Reusing a cached/shared value never calls this constructor.

Source

pub fn record( &self, fields: Vec<(Atom, Value)>, ctx: Ctx, node: u32, diagnostic: bool, ) -> Result<Value>

Builds an actual record constructor with this owner’s source-hook facts.

§Errors

Duplicate fields, exactly as Value::record.

Source

pub fn recover(&self, failure: ReceiverFailure) -> Option<(u32, bool)>

Recovers a catch only for this owner: constructor node and source-hook state.

Trait Implementations§

Source§

impl Debug for ReceiverDomain

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.