Skip to main content

PublishesPresence

Trait PublishesPresence 

pub trait PublishesPresence: Widget {
    // Provided methods
    fn presence_key(&self) -> Option<PresenceKey> { ... }
    fn presence_payload(&self) -> Option<(PresenceKey, PresencePayload)> { ... }
    fn composing_payload(&self) -> Option<(PresenceKey, PresencePayload)> { ... }
    fn shared_selection(&self) -> Option<SharedSelection> { ... }
}
Expand description

A widget with a presence identity and, while focused, outbound presence.

Provided Methods§

fn presence_key(&self) -> Option<PresenceKey>

Stable identity for presence and permission lookup.

fn presence_payload(&self) -> Option<(PresenceKey, PresencePayload)>

Outbound presence (typically caret/selection) broadcast while this widget holds focus; the host polls the focused widget after each event and diffs it out to peers.

fn composing_payload(&self) -> Option<(PresenceKey, PresencePayload)>

Whether this widget is composing a message where it stands (a conversation’s composer holding a draft): published under the key beside it, so a reader can say “… is typing”. Ephemeral, a presence frame; never what the draft says.

fn shared_selection(&self) -> Option<SharedSelection>

What the person has selected here while this widget is focused, for asking an agent about it. None derives it from Self::presence_payload and the accessibility node (see crate::shared_selection::selection_of); a widget whose selection those cannot describe (one spanning blocks, offsets in another text) answers itself.

Implementors§