Skip to main content

PublishesResources

Trait PublishesResources 

pub trait PublishesResources: Widget {
    // Provided methods
    fn resources(&self, _doc: &AutoCommit) -> Vec<Resource> { ... }
    fn caller_view_resources(&self, _doc: &AutoCommit) -> Vec<Resource> { ... }
    fn action_directory_resource_page(
        &self,
        _doc: &AutoCommit,
        _cursor: &[u8],
        _max_results: usize,
    ) -> Option<ActionDirectoryResourcePage> { ... }
    fn action_directory_revision(&self, _doc: &AutoCommit) -> Option<String> { ... }
    fn action_directory_invocation_domain(
        &self,
        _doc: &AutoCommit,
    ) -> ActionDirectoryInvocationDomain { ... }
    fn resource(&self, _doc: &AutoCommit, _id: &str) -> Option<Resource> { ... }
    fn resources_for(
        &self,
        participant: Option<&ParticipantId>,
        doc: &AutoCommit,
    ) -> Vec<Resource> { ... }
    fn shared_resources_for(
        &self,
        participant: Option<&ParticipantId>,
        doc: &AutoCommit,
    ) -> Option<Vec<SharedResource>> { ... }
    fn resource_for(
        &self,
        participant: Option<&ParticipantId>,
        doc: &AutoCommit,
        id: &str,
    ) -> Option<Resource> { ... }
    fn action_directory_visibility(
        &self,
        _doc: &AutoCommit,
        _resource_id: &str,
    ) -> Option<ActionAddress> { ... }
    fn document_action_result(
        &self,
        _doc: &AutoCommit,
        _address: &ActionAddress,
        _changes: &[Patch],
    ) -> Option<Value> { ... }
}
Expand description

A widget that publishes resources.

Provided Methods§

fn resources(&self, _doc: &AutoCommit) -> Vec<Resource>

The tree of resources this widget currently has open, each with the actions it exports, e.g. a playing video plus its comments. doc lets a provider enumerate resources living in the document.

fn caller_view_resources(&self, _doc: &AutoCommit) -> Vec<Resource>

Explicit host-local presentation/request controls for the portable caller palette. Only View operations are accepted; shared effects remain broker-owned.

fn action_directory_resource_page( &self, _doc: &AutoCommit, _cursor: &[u8], _max_results: usize, ) -> Option<ActionDirectoryResourcePage>

One cursor-addressable page of resource roots safe to expose through the broker pull directory. max_results is a hard ceiling; a live provider must return a non-empty opaque cursor when it has a tail. None is the default: an unbounded contextual Self::resources snapshot must not be reached from a remote query or revision.

fn action_directory_revision(&self, _doc: &AutoCommit) -> Option<String>

Revision of non-document bounded directory roots; None when this widget has no independently mutable remote directory state.

fn action_directory_invocation_domain( &self, _doc: &AutoCommit, ) -> ActionDirectoryInvocationDomain

Continuity coverage for this owning subtree’s effective invocation domain. Returning a value is a semantic promise, not authority; unknown coverage stays closed.

fn resource(&self, _doc: &AutoCommit, _id: &str) -> Option<Resource>

Resolve an addressable resource omitted from the contextual snapshot.

fn resources_for( &self, participant: Option<&ParticipantId>, doc: &AutoCommit, ) -> Vec<Resource>

The tree as one participant (an agent task) sees it, built from that participant’s own view state. None is this widget’s own view. Multi-participant widgets override this and Self::resource_for, and never put one participant’s selection into another’s tree.

fn shared_resources_for( &self, participant: Option<&ParticipantId>, doc: &AutoCommit, ) -> Option<Vec<SharedResource>>

Self::resources_for as a SharedResource forest whose unchanged subtrees are the very nodes of the last one, so consumers skip what they have seen. None, the default, has callers wrap Self::resources_for. An answer must equal it exactly once materialised (SharedResource::to_resource).

fn resource_for( &self, participant: Option<&ParticipantId>, doc: &AutoCommit, id: &str, ) -> Option<Resource>

Self::resource in participant’s tree.

fn action_directory_visibility( &self, _doc: &AutoCommit, _resource_id: &str, ) -> Option<ActionAddress>

Explicit disclosure authority for an actionless resource container in the broker pull directory. None means its label and hierarchy are not remotely discoverable unless the resource itself has a safe view action.

fn document_action_result( &self, _doc: &AutoCommit, _address: &ActionAddress, _changes: &[Patch], ) -> Option<Value>

The result of document action address, which has just applied to doc as changes: a compact summary of what it produced, so its caller needs no second read to see what happened. Asked only for an action whose contract declares a JSON result, which this value must satisfy.

Implementors§