Effect

Enum Effect 

Source
pub enum Effect {
Show 16 variants Ingress, Durable, Dom, Nondet, NetOut(Arc<str>), NetIn, FsRead(Arc<str>), FsWrite(Arc<str>), Env, Spawn, Cap(Arc<str>), Partial, Raises(Arc<str>), ExternalRead(Arc<str>), ExternalWrite(Arc<str>), Ambient(Ambient),
}
Expand description

An effect atom. §3.2’s list, with the one correction Phase 2 makes to it (see Effect::Nondet).

Variants§

§

Ingress

A merge point: arbitrary interleaving. “there is exactly one of these” (§3.7).

§

Durable

A persistent accumulator — the log.

§

Dom

Touches the document.

§

Nondet

Reads a clock, a random source, or mints an id.

§3.2 files time and rand under the ambient set — “implicitly available outside folds and elided from signatures”. Phase 2 does not, and the reason is §3.3’s own table: the fold engine is a tier, and whether a tier can discharge time and randomness is precisely §3.7’s determinism rule. An effect that decides a placement cannot also be elided from the signature that placement is derived from. log and metrics stay ambient (Effect::Ambient); these do not.

§

NetOut(Arc<str>)

net.out(host) — an outbound call to a named host. The host is what docs/06-kubernetes-and-packaging.md §6.5 turns into a NetworkPolicy peer.

§

NetIn

net.in — accepts inbound connections.

§

FsRead(Arc<str>)

fs.read(path) and fs.write(path) — two atoms for one resource.

§3.2 listed a single fs(path) until docs/81. One atom naming a resource without saying what is done to it cannot answer the two questions that are actually asked of it: whether two things may happen at once (crate::check’s parallel: rule) and whether a mount needs to be writable (docs/06 §6.5). §3.8’s escape hatches were already two — Effect::ExternalRead and Effect::ExternalWrite — and this is the same split for the same reason.

§

FsWrite(Arc<str>)

§

Env

Reads process environment.

§

Spawn

Starts concurrent work.

§

Cap(Arc<str>)

cap.X — a capability the caller must hold. §3.5: “forgetting an auth check means the cap.* effect goes undischarged — a compile error, not a pentest finding”.

§

Partial

May diverge or panic.

§

Raises(Arc<str>)

raises(E) — this may fail with a value of the named type.

An error is a row label, not a mechanism: a signature without one provably cannot fail, and Result[T, E] is the reified form a handler produces rather than a parallel channel (docs/38 §38.4, adopting Koka’s exn). The atom names the error’s type because a handler has to say what it catches — a try that caught everything would turn a caller’s unknown failure into this one’s Result.

§

ExternalRead(Arc<str>)

§3.8’s escape hatches: an existing store the team already has.

§

ExternalWrite(Arc<str>)

§

Ambient(Ambient)

The ambient set that survives §3.2’s description: available everywhere, elided from signatures, and never a reason to place anything.

Implementations§

Source§

impl Effect

Source

pub fn name(&self) -> String

Source

pub fn parse(s: &str) -> Option<Effect>

Parse an atom as written in a uses clause: durable, net.out(api.example.com), cap.session.

Source

pub fn is_ambient(&self) -> bool

Ambient effects are available on every tier and elided from printed signatures (§3.2).

Source

pub fn family(&self) -> &'static str

The atom without its argument — what a tier’s discharge table and a cost model key on.

Source§

impl Effect

Source

pub fn breaks_replay(&self) -> bool

Does this effect make a fold a different function of the log? §3.7’s replay-purity rule, stated as a property of the atom rather than as “the row is empty”.

log and metrics do not (they are write-only observations, §19.8), partial does not (a fold that aborts produces no state, rather than a different one), and raises does not (the same value raised for the same input, every replay). Everything else does.

Trait Implementations§

Source§

impl Clone for Effect

Source§

fn clone(&self) -> Effect

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Effect

Source§

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

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

impl Display for Effect

Source§

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

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

impl Hash for Effect

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Effect

Source§

fn cmp(&self, other: &Effect) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Effect

Source§

fn eq(&self, other: &Effect) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Effect

Source§

fn partial_cmp(&self, other: &Effect) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for Effect

Source§

impl StructuralPartialEq for Effect

Auto Trait Implementations§

§

impl Freeze for Effect

§

impl RefUnwindSafe for Effect

§

impl Send for Effect

§

impl Sync for Effect

§

impl Unpin for Effect

§

impl UnwindSafe for Effect

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

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.