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: u32The storage version (#[resource(version = N)]).
person: boolA 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: boolEach 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).
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).
Sourcepub fn with_setters(self) -> Self
pub fn with_setters(self) -> Self
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.
Sourcepub fn verb(&self, action: &str) -> Option<(ActionKind, Option<String>)>
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.
Sourcepub fn editable(&self, path: &[PathStep]) -> bool
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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Surface
impl<'de> Deserialize<'de> for Surface
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Surface
Auto Trait Implementations§
impl Forget for Surface
impl Freeze for Surface
impl Move for Surface
impl RefUnwindSafe for Surface
impl Send for Surface
impl Sync for Surface
impl Unpin for Surface
impl UnsafeUnpin for Surface
impl UnwindSafe for Surface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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