Skip to main content

Sharing

Trait Sharing 

Source
pub trait Sharing: MaybeSend + 'static {
    // Provided methods
    fn offers(&self, kind: ShareKind) -> ShareOffer { ... }
    fn link(&self, kind: ShareKind, name: &str, reply: Reply<ShareLink>) { ... }
    fn copy(&self, kind: ShareKind, name: &str, reply: Reply<String>) { ... }
}
Expand description

Sharing a layout or watchlist, supplied by a host that has accounts and somewhere to keep shared documents. The library owns neither: it shows the controls the host offers and reports the host’s answers. Without a service the layout menu and the watchlist panel offer no sharing.

Methods are called on the UI thread and return at once; answer through the Reply you were given, from any thread, runtime or browser task. Answer an error, such as FeedError::Other with the reason, to reject an operation: the menu shows it. The documents are the ones the host already holds under name.

Provided Methods§

Source

fn offers(&self, kind: ShareKind) -> ShareOffer

Which operations to offer for kind. The default offers none.

A view-only link to the document name of kind. The library copies the link to the clipboard and tells the user whether a recipient may save a copy.

Source

fn copy(&self, kind: ShareKind, name: &str, reply: Reply<String>)

Saves a copy of the document name of kind for the user and answers the copy’s name. A layout copy is read back from Storage, so the host writes it there; a watchlist copy is added to the panel’s lists under the answered name.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§