Skip to main content

LiveRow

Struct LiveRow 

Source
pub struct LiveRow { /* private fields */ }
Expand description

One live external entity a surface publishes beneath its resource, with the view and effect operations it offers (inspect a process, stop a container).

Rows are merged by id into the resource’s published children: a row with the id of a document child adds its operations to that child instead of publishing a second resource under the same id.

A row is shared, not copied: a surface that keeps the rows it made while what they show holds hands the same rows to every publication, and the publication reuses what it built from each one instead of building it again.

LiveRow::typed is the one way to publish a row: it is an item of a declared RowType, saying what it is to search and offering the type’s effects, so a press on it is one of the type’s actions or open.

Implementations§

Source§

impl LiveRow

Source

pub fn typed<R: RowType>( id: impl Into<String>, label: impl Into<String>, ) -> Self

A row of the declared type R (a resource type of R’s kind), whose noun its type publishes, of the app the type is declared in: its id, its label, the ResourceType search matches “videos of …” against, and the effects the type offers on it (RowType::effects, each bound to id). A row an app declares as an item of a #[resource] type publishes (Video, Channel) is one of these, so what it is is the type’s and the search’s, nothing the app writes.

Source

pub fn typed_with<R: RowType>( id: impl Into<String>, label: impl Into<String>, bindings: &RowBindings, ) -> Self

A row of the declared type R, offering the effects bindings names among the type’s (RowType::effects_with), each bound to what the row’s own state knows: unlike Self::typed, which offers every effect the type declares on its rows with only the id bound, this one leaves out the effects that do not apply (a network with no proxy) and sets the arguments the row holds (the profile, the direction of a toggle).

Source

pub fn semantic_identity(self, identity: ResourceSemanticIdentity) -> Self

Attach the stable source-domain identity used to find this row across live dispatch aliases. It is descriptive metadata only and grants no permission or authority. Invalid identities are omitted at this publication boundary.

Source

pub fn declared(resource: ResourceSpec) -> Self

resource, an entity a declaration shaped — a document’s child, a search hit’s place, a tree a declared type’s verbs built — as a row: its presentation, views, operations and children, its document actions dropped at any depth (the resource’s own publication carries them). The entity says what it is (its type’s words), so search names it by that and its type’s effects are the ones it offers.

§Panics

When resource names no declared type: an entity no declaration shaped has no words to be searched by and no type whose effects it offers, so it is not a row. Publish it as one with Self::typed instead.

Source

pub fn vocabulary<E: Effect>(self) -> Self

Offer a view or effect operation on the row.

Offer every effect of the vocabulary E the resource itself offers (Effect::specs), as it publishes them: what a window’s own row offers (navigate, show settings), beside the effects its row types declare.

Source

pub fn presentation(self, presentation: ResourcePresentation) -> Self

How the entity stands right now (a process’s CPU use, what a timer has left), shown beside its label. A row merged into a document child that has no presentation of its own lends it this one.

Source

pub fn labelled<E, A>( self, effect: ActionRef<E, A>, label: impl Into<String>, ) -> Self

Offer the row’s effect effect as label here, where the row can say what it is more exactly than its type can (a container’s row opens this container by name). The effect’s contract is its declaration’s; only what the row reads it by is the row’s.

Source

pub fn prefilled<R, A, I, K>(self, effect: ActionRef<R, A>, values: I) -> Self
where I: IntoIterator<Item = (K, Value)>, K: Into<String>,

Offer effect with values already in its parameters’ fields, each still asked: what the row’s state knows the effect would act with unless its caller says otherwise (a calendar’s current colour, a switch’s next state). Published as the parameters’ defaults, so a surface fills the field and an agent reads it, and the invocation binds whatever is finally given. The contract stays the declaration’s.

Source

pub fn view(self, view: ResourceViewSpec) -> Self

Offer view of the row’s entity: a way to show it (a message in its conversation, a range of its text) that a link or an agent navigates to, opened by one of the row’s own operations.

Source

pub fn unavailable( self, effect: &str, code: impl Into<String>, reason: impl Into<String>, ) -> Self

Offer the row’s operation effect as unavailable, with code a program reads and reason a person reads.

Source

pub fn describe(self, effect: &str, description: impl Into<String>) -> Self

Say what the row’s operation effect does on this row, where only the row can say it.

Source

pub fn row(self, row: LiveRow) -> Self

Nest row beneath this one (a container’s logs).

Source

pub fn id(&self) -> &str

Source

pub fn find(&self, id: &str) -> Option<Self>

The row id names, this one or one nested beneath it, as a row of its own: what a control showing that entity binds to.

Source

pub fn operations(&self) -> &[ActionSpec]

The operations the row offers, as it publishes them.

Source

pub fn into_resource(self) -> ResourceSpec

The row as the published tree carries it.

Source

pub fn same_row(&self, other: &Self) -> bool

Whether self and other are the same row, handed out again: a clone of one row, not two rows that read alike.

Trait Implementations§

Source§

impl Clone for LiveRow

Source§

fn clone(&self) -> Self

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 Exports for LiveRow

A control binds to the row it shows: ActionBinding::unit_for(&row, effect.id()).

Source§

fn exported(&self) -> &ResourceSpec

The resource as it is published: its identity, kind, sharing and exported actions.

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