Skip to main content

Surface

Struct Surface 

Source
pub struct Surface {
    pub kind: String,
    pub label: String,
    pub version: u32,
    pub person: bool,
    pub readers: Option<ReaderRule>,
    pub verbs: Vec<VerbSurface>,
    pub fields: Vec<FieldSurface>,
    pub types: Vec<NamedType>,
    pub shows: Vec<String>,
    pub live: Option<LiveSurface>,
    pub setters: bool,
}
Expand description

The public surface of one resource kind. See the module docs.

Fields§

§kind: String§label: String§version: u32

The storage version (#[resource(version = N)]).

§person: bool

A record of the person’s own, kept in their store rather than the workspace of the window showing it: one the app declares with itself (its ResourceApp::PERSON_RESOURCES, as PersonKind::profile). Only the kinds an app’s surface marks so may it keep in, or read from, the person’s store.

§readers: Option<ReaderRule>

Who reads a record of the kind, when not every member of the workspace (core.md, “One set of resources per workspace”): each record is sealed to exactly its readers’ key group, and the store works out who they are (ReaderRule). Absent for a kind every member reads.

§verbs: Vec<VerbSurface>

Absent from a surface file that lists none.

§fields: Vec<FieldSurface>

Every stored field, depth first; empty for a resource without a model shape.

§types: Vec<NamedType>

The records and enums its fields’ types name (FieldType::Named), each declared once, by name.

§shows: Vec<String>

The actions that show something in a window of the app (its view effects), on whatever resource of it they are invoked: a row the app publishes for one person or item as much as the app itself. A closed app asked for one is started with a window.

§live: Option<LiveSurface>

When a resource of the kind is a live activity (a track playing, a timer running), and the view that shows it then; None for a kind that never is.

§setters: bool

Each of its fields is written by its own setter, set-<field>, and by no field edit: the setters follow from the fields (Self::with_setters), as a settings section publishes them.

Implementations§

Source§

impl Surface

What a receiver without the app reads from its surface: each verb’s kind and tree field, which paths offer field edits, and which storage units an action may write (* for any item).

Source

pub fn with_setters(self) -> Surface

This surface with a setter of each of its own fields that is not read only and has no declared verb of the setter’s id, as a settings section publishes them: setter_id, taking the field’s whole new value (not for a collection or a keyed map, which change item by item) and, unless the field is set only FieldSurface::whole, an edit inside it.

Source

pub fn named(&self, name: &str) -> Option<&NamedType>

The named type name of Self::types.

Source

pub fn verb(&self, action: &str) -> Option<(ActionKind, Option<String>)>

The kind of the verb action and the field it sits under, or None when the app publishes no such verb.

Source

pub fn editable(&self, path: &[PathStep]) -> bool

Whether the field at path offers edits: stored, and neither it nor a field above it read-only. Reactions are the exception: their only edits record who invoked them, so they forge nothing a read-only field protects, and the record refuses any other edit of them.

Source

pub fn edit_unit(&self, path: &[PathStep]) -> Vec<PathStep>

The storage unit a field edit at path writes: the field’s unit, an item of a unit collection, else the record (the empty path).

Source

pub fn footprint(&self, action: &str, item: Option<&str>) -> Vec<Vec<PathStep>>

The units the verb action may write, on the item item when it acts on one: the record (the empty path), its item’s unit, and the units of the fields it declares, * for any item.

Trait Implementations§

Source§

impl Clone for Surface

Source§

fn clone(&self) -> Surface

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Surface

Source§

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

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

impl<'de> Deserialize<'de> for Surface

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Surface, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Surface

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Surface

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Surface

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more