Skip to main content

AttachmentStore

Trait AttachmentStore 

pub trait AttachmentStore {
    // Required methods
    fn holds(
        &mut self,
        holder: Holder,
        namespace: &str,
        name: &str,
    ) -> Result<bool, AttachmentError>;
    fn decoded(
        &mut self,
        holder: Holder,
        namespace: &str,
        name: &str,
    ) -> Result<Option<Arc<dyn Any + Send + Sync>>, AttachmentError>;
    fn saved(
        &mut self,
        holder: Holder,
        namespace: &str,
        name: &str,
    ) -> Result<Option<BTreeMap<JavaString, Tag>>, AttachmentError>;
    fn store(
        &mut self,
        holder: Holder,
        namespace: &str,
        name: &str,
        value: Arc<dyn Any + Send + Sync>,
        form: AttachmentForm,
    ) -> Result<(), AttachmentError>;
    fn discard(
        &mut self,
        holder: Holder,
        namespace: &str,
        name: &str,
        sync: bool,
    ) -> Result<(), AttachmentError>;
    fn queue_sync(
        &mut self,
        holder: Holder,
        namespace: &str,
        name: &str,
    ) -> Result<(), AttachmentError>;
}
Expand description

The current server’s holders’ values, erased to what crosses any boundary: the typed AttachmentType methods are built on it, for a native mod and a wasm mod alike.

Required Methods§

fn holds( &mut self, holder: Holder, namespace: &str, name: &str, ) -> Result<bool, AttachmentError>

Whether holder keeps a value under namespace:name, saved or decoded.

fn decoded( &mut self, holder: Holder, namespace: &str, name: &str, ) -> Result<Option<Arc<dyn Any + Send + Sync>>, AttachmentError>

The value under namespace:name if it has been decoded.

fn saved( &mut self, holder: Holder, namespace: &str, name: &str, ) -> Result<Option<BTreeMap<JavaString, Tag>>, AttachmentError>

The saved form under namespace:name if it hasn’t been decoded yet.

fn store( &mut self, holder: Holder, namespace: &str, name: &str, value: Arc<dyn Any + Send + Sync>, form: AttachmentForm, ) -> Result<(), AttachmentError>

Keep value under namespace:name, with what comes with it.

fn discard( &mut self, holder: Holder, namespace: &str, name: &str, sync: bool, ) -> Result<(), AttachmentError>

Drop the value under namespace:name, saved or decoded; clients hear of it if sync.

fn queue_sync( &mut self, holder: Holder, namespace: &str, name: &str, ) -> Result<(), AttachmentError>

Send the value under namespace:name to the clients that see the holder again.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

§

impl AttachmentStore for dyn ClientHost + '_

§

impl AttachmentStore for dyn Host + '_

§

impl AttachmentStore for dyn LevelRandomHost + '_

§

impl AttachmentStore for dyn LevelWriteHost + '_

§

impl AttachmentStore for dyn ServerHost + '_

§

impl<H> AttachmentStore for H
where H: AttachmentHost + ?Sized,