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> { ... }
    fn presence_range_rects(
        &self,
        theme: &Theme,
        key: &PresenceKey,
        range: SelectionRange,
    ) -> Vec<Rect> { ... }
}
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.

fn presence_range_rects( &self, theme: &Theme, key: &PresenceKey, range: SelectionRange, ) -> Vec<Rect>

Where this widget draws a remote member’s caret or selection range at key, in surface coordinates, at its own text geometry — the same rects it paints their caret and band at. Empty when this widget shows nothing at that key. What marks where that member is in this text, and what following them brings into view (range_locus).

Implementors§