Struct ResourceSpec
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 readers: Readers,
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.
readers: ReadersWho may read the reading this resource publishes.
resource_type: Option<ResourceType>What it is, as people name it, when its type says (ResourceType).
Implementations§
§impl ResourceSpec
impl ResourceSpec
pub fn new( id: impl Into<String>, kind: impl Into<String>, label: impl Into<String>, ) -> ResourceSpec
pub 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).
pub fn with_presentation( self, presentation: ResourcePresentation, ) -> ResourceSpec
pub fn with_type(self, resource_type: ResourceType) -> ResourceSpec
pub fn with_type(self, resource_type: ResourceType) -> ResourceSpec
Saying what it is, as people name it.
pub fn with_action(self, action: ActionSpec) -> ResourceSpec
pub fn with_view(self, view: ResourceViewSpec) -> ResourceSpec
pub fn with_granted_reading(self) -> ResourceSpec
pub fn with_granted_reading(self) -> ResourceSpec
Publish this resource’s reading only to callers the workspace grants it to
(Readers::Granted): what the person’s own state needs, when it is
theirs alone.
pub 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) -> ResourceSpec
pub 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.
pub fn person_action_count(&self) -> usize
pub fn person_action_count(&self) -> usize
How many of its actions a person may take.
pub 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>, ) -> ResourceSpec
pub 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§
§impl Clone for ResourceSpec
impl Clone for ResourceSpec
§fn clone(&self) -> ResourceSpec
fn clone(&self) -> ResourceSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ResourceSpec
impl !RefUnwindSafe for ResourceSpec
impl Send for ResourceSpec
impl Sync for ResourceSpec
impl Unpin for ResourceSpec
impl UnsafeUnpin for ResourceSpec
impl !UnwindSafe 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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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