Roles

Struct Roles 

Source
pub struct Roles {
Show 16 fields pub validate: Core, pub fold: Core, pub init: Core, pub view: Core, pub state_ty: Ty, pub event_ty: Ty, pub command_ty: Ty, pub proposals_name: Arc<str>, pub events_name: Arc<str>, pub state_name: Arc<str>, pub page_name: Arc<str>, pub inlined: Vec<Arc<str>>, pub shared: Vec<Arc<str>>, pub states: Vec<StateRole>, pub view_is_per_session: bool, pub view_reads_presence: bool,
}
Expand description

The five things the runtime needs, each a Core value it can call.

This is deliberately still five: a runtime that drives one log, one accumulator and one page is what Phase 1 built and what Phase 3 has not replaced. What changed is that these are now derived from the graph — fusing several folds, inlining or sharing intermediate signals — so the shape of the program and the shape of the runtime are no longer required to be the same.

Fields§

§validate: Core

(state, proposal) -> Result[list[Event], Rejection] — the authority chokepoint.

§fold: Core

(state, Envelope[Event]) -> state — the replay-pure fold.

§init: Core

The fold’s initial accumulator.

§view: Core

(state, session, presence) -> Html — the client-placed view, with intermediate signals inlined or shared.

Three parameters whether or not the program reads the third: a role the runtime calls has one arity, and a view that ignores its presence argument is cheaper than two code paths that could disagree about which one it has.

§state_ty: Ty§event_ty: Ty§command_ty: Ty§proposals_name: Arc<str>

Names, for beck explain and for the report.

§events_name: Arc<str>§state_name: Arc<str>§page_name: Arc<str>§inlined: Vec<Arc<str>>

Signals that were inlined into the view rather than surviving as their own node.

§shared: Vec<Arc<str>>

Signals read by more than one consumer, and therefore bound once in the sliced view rather than recomputed per use. §5.3’s shared prefix, at compile time.

§states: Vec<StateRole>

The durable folds, in declaration order. One entry for the ordinary program; several when the accumulator is fused.

§view_is_per_session: bool§view_reads_presence: bool

Whether the page reads presence(), and therefore has an input the log does not contain.

Implementations§

Source§

impl Roles

Source

pub fn is_fused(&self) -> bool

Whether the accumulator is a synthetic record over several folds.

Trait Implementations§

Source§

impl Clone for Roles

Source§

fn clone(&self) -> Roles

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 Roles

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Roles

§

impl RefUnwindSafe for Roles

§

impl Send for Roles

§

impl Sync for Roles

§

impl Unpin for Roles

§

impl UnwindSafe for Roles

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