pub struct Presence { /* private fields */ }
Expand description

Presence to visualize the mesh.

Even if Ditto works as a standalone, other peers are needed to exploit it at its maximum extend : syncing data and merging it.

The Presence struct allows you to get and monitor known peers. The peers are regrouped inside a PresenceGraph.

You can get Presence using the Ditto::presence method. To have an immediate graph of peers, use Presence::exec:

let presence_graph = ditto.presence().exec();

To monitor peers, use Presence::observe to call a callback each time peers are updated:

let handle = ditto.presence().observe(|presence_graph| {
    // Do something with peers
});

Implementations

Allow to call a callback each time there is a change in known peers. The returned PresenceObserver must be kept in scope to keep receiving updates.

Return an immediate representation of known peers

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts to T by calling Into<T>::into.
Tries to convert to T by calling TryInto<T>::try_into.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.