pub struct ResourceSpec {
pub id: ResourceId,
pub kind: String,
pub label: String,
pub presentation: Option<ResourcePresentation>,
pub semantic_identity: Option<ResourceSemanticIdentity>,
pub app_id: Option<String>,
pub children: Vec<ResourceSpec>,
pub actions: Vec<ActionSpec>,
pub views: Vec<ResourceViewSpec>,
pub personal: bool,
pub workspace: Option<String>,
pub resource_type: Option<ResourceType>,
}Expand description
One open/presented resource and the actions it exports. Resources
nest via children.
Fields§
§id: ResourceId§kind: StringA stable kind tag (e.g. "tube.video", "ebook.annotation"),
shared with the global-search type registry for OS-wide enumeration.
label: StringHuman, localisable label shown in the palette.
presentation: Option<ResourcePresentation>Optional shell-rendered metadata used by system search and resource browsers. Invalid or oversized values are omitted at the boundary.
semantic_identity: Option<ResourceSemanticIdentity>Exact original typed identity retained before host namespacing.
app_id: Option<String>The app that publishes it, as the ActionKeys
of its actions name it: the one whose resource this is, not the
provider keeping it in a workspace. None for a resource published
outside an app.
children: Vec<ResourceSpec>§actions: Vec<ActionSpec>§views: Vec<ResourceViewSpec>Explicit presentations of this resource. Actions remain invocation mechanisms; only entries in this collection are resource views.
personal: boolWhether the reading is the person’s own rather than everyone’s: their clipboard, their notifications. Only a program the session runs itself reads it; an installed app reads what its own records hold.
workspace: Option<String>The workspace that holds the record, when it is not the one the window publishing it is
open in: a person’s profile record, held in their own workspace. That workspace decides
the record’s changes; None is the window’s.
resource_type: Option<ResourceType>What it is, as people name it, when its type says (ResourceType).
Implementations§
Source§impl ResourceSpec
impl ResourceSpec
Sourcepub fn address_of(&self, action: &ActionSpec) -> ActionAddress
pub fn address_of(&self, action: &ActionSpec) -> ActionAddress
The address of action as this resource publishes it: what the API
takes, what a window’s control bound to it says it does, and what the
survey lists — one address, which neither the window’s composition
moving the control nor the person’s language renaming it changes.
Sourcepub fn app(&self) -> Option<&str>
pub fn app(&self) -> Option<&str>
The app that publishes it, as an ActionKey of
one of its actions names it (Self::app_id).
Sourcepub fn domain_name(&self) -> &str
pub fn domain_name(&self) -> &str
The resource’s own id, not the transport alias a window published it
under (Self::semantic_identity): what its app and the directory
naming it offer it at, whatever alias the broker delivers it under.
pub fn with_presentation(self, presentation: ResourcePresentation) -> Self
Sourcepub fn with_type(self, resource_type: ResourceType) -> Self
pub fn with_type(self, resource_type: ResourceType) -> Self
Saying what it is, as people name it.
pub fn with_action(self, action: ActionSpec) -> Self
pub fn with_view(self, view: ResourceViewSpec) -> Self
Sourcepub fn with_personal_reading(self) -> Self
pub fn with_personal_reading(self) -> Self
Publish this resource’s reading to the session’s own programs alone: what the person’s state needs, when it is theirs and not an app’s.
Sourcepub fn held_in(self, workspace: impl Into<String>) -> Self
pub fn held_in(self, workspace: impl Into<String>) -> Self
The record is held in workspace rather than in the window’s (Self::workspace).
Sourcepub fn retain_actions(&mut self, keep: impl FnMut(&ActionSpec) -> bool)
pub fn retain_actions(&mut self, keep: impl FnMut(&ActionSpec) -> bool)
Keep the actions keep admits, and only the views still opened by
one of them: a view whose open action is not offered cannot be
offered either, and the action contract refuses the whole surface
that carries one.
pub fn with_child(self, child: ResourceSpec) -> Self
Sourcepub fn listed_for_people(&self) -> bool
pub fn listed_for_people(&self) -> bool
Whether a palette may list it: a titled resource that offers a person at least one action of its own. An untitled node, a control mirror, and a node left with only agent actions are all addressing machinery, and a list of what a person may act on never shows them.
Sourcepub fn person_action_count(&self) -> usize
pub fn person_action_count(&self) -> usize
How many of its actions a person may take.
Sourcepub fn open_action(&self) -> Option<&ActionSpec>
pub fn open_action(&self) -> Option<&ActionSpec>
The action that presents it, when a person may take it: what a palette lists the resource for.
pub fn with_children( self, children: impl IntoIterator<Item = ResourceSpec>, ) -> Self
Sourcepub fn action_address(&self, action: &str) -> Option<ActionAddress>
pub fn action_address(&self, action: &str) -> Option<ActionAddress>
The address of the action action this resource publishes, or None
when it publishes none by that id. A caller holding a published
resource (a survey’s, a search hit’s, a bound tree’s) addresses its
actions from it rather than writing an address of its own, so an
action the resource stopped publishing fails here, at the caller.
Trait Implementations§
Source§impl Clone for ResourceSpec
Written out rather than derived: a derived clone is inlined into every
app that copies a resource, this one is compiled once.
impl Clone for ResourceSpec
Written out rather than derived: a derived clone is inlined into every
app that copies a resource, this one is compiled once.
Source§impl Exports for ResourceSpec
impl Exports for ResourceSpec
Source§fn exported(&self) -> &ResourceSpec
fn exported(&self) -> &ResourceSpec
Auto Trait Implementations§
impl !RefUnwindSafe for ResourceSpec
impl !UnwindSafe for ResourceSpec
impl Forget for ResourceSpec
impl Freeze for ResourceSpec
impl Move for ResourceSpec
impl Send for ResourceSpec
impl Sync for ResourceSpec
impl Unpin for ResourceSpec
impl UnsafeUnpin for ResourceSpec
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,
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