Skip to main content

PresenceKey

Enum PresenceKey 

pub enum PresenceKey {
    Widget {
        path: Vec<PathSegment>,
    },
    Tab {
        id: String,
    },
    Workspace {
        id: String,
    },
    App {
        app: AppKind,
        sub: String,
    },
    View {
        data: Vec<u8>,
    },
    Pointer {
        space: PointerSpace,
    },
    Resource {
        app: String,
        id: String,
        kind: String,
    },
}

Variants§

§

Widget

Fields

§

Tab

Fields

§

Workspace

Fields

§

App

Fields

§

View

A participant’s broadcast ViewSubset, carried as its postcard encoding. PresencePayload has no View variant of its own, so it rides the existing presence frame inside the routing key instead. Bytes rather than a live struct because the key must stay Hash + Eq, which f64 viewport fields are not.

Fields

§data: Vec<u8>
§

Pointer

A pointer position, together with the coordinate space it was measured in. Every other variant is a scope; the scope of a pointer is the space its numbers mean something in. See PointerSpace.

Fields

§

Resource

Stable action resource scope. It deliberately carries no pixels: the receiving app resolves id against its own live layout.

Fields

§kind: String

Implementations§

§

impl PresenceKey

pub fn widget(path: &[PathSegment]) -> Option<PresenceKey>

The key of the widget at path, or None for one without a presence path.

pub fn scope_digest(&self) -> Option<[u8; 16]>

16-byte digest of this key’s canonical (postcard) encoding. Used where a scope does not fit a bounded carrier, e.g. the 64-byte LIVE_V1 anchor, whose Writer keys can name 130-byte block ids.

pub fn from_scope_digest(digest: [u8; 16]) -> PresenceKey

The stand-in key a receiver files a digest-addressed scope under (Widget{[DIGEST_KEY_FIELD, hex(digest)]}). An editor that draws remote presence also looks its own keys up in this form (Self::digest_form), so the two meet without the receiver ever knowing the full scope.

pub fn digest_form(&self) -> Option<PresenceKey>

This key’s digest-addressed stand-in (see Self::from_scope_digest).

pub fn view(subset: &ViewSubset) -> PresenceKey

Wrap a ViewSubset as a presence key for broadcast. Encode failure yields empty bytes, which Self::as_view decodes back to None — a dropped frame, never a panic.

pub fn as_view(&self) -> Option<ViewSubset>

Decode a broadcast ViewSubset back out of a PresenceKey::View. None for any other variant, or for View bytes that fail to decode.

pub fn for_local_workspace() -> Option<PresenceKey>

The scope this process should publish its presence under — the room it collaborates in, or None when it has no room. Read from local_cluster_id, the same value the routing address is built from, so the two cannot drift apart.

None when the room is the nil uuid: that value addresses nobody (CrdtRoute::is_addressable rejects it — an unminted room would otherwise make every unconfigured machine share one room). Fail closed.

pub fn desktop_pointer(room: impl Into<String>) -> PresenceKey

The key a pointer measured on room’s desktop is published under.

pub fn tile_pointer(room: impl Into<String>, tab: u64) -> PresenceKey

The key a pointer placed relative to the tile of room’s tab tab is published under.

pub fn surface_pointer(surface: impl Into<String>) -> PresenceKey

The key a pointer measured inside surface’s content is published under.

pub fn local_surface_pointer() -> PresenceKey

Self::surface_pointer for this process’s own surface. The coordinates a winit CursorMoved carries are surface-local, so this is the only representation an app can provide.

pub fn resource( app: impl Into<String>, id: impl Into<String>, kind: impl Into<String>, ) -> PresenceKey

pub fn pointer_space(&self) -> Option<PointerSpace>

The coordinate space a pointer arriving under this key is measured in, or None for a key that is not a pointer scope at all. Two older spellings still mean “desktop”: PresenceKey::Workspace, the session’s own desktop pointer republished per room, and Self::pointer_default, the tag the keyless capnp publishCursor path was re-keyed to.

pub fn scopes_a_desktop_pointer(&self) -> bool

Whether a pointer arriving under this key is a position on the desktop — one the compositor overlay places, above every window — rather than inside one window’s content. Reading the legacy keyless tag as an ordinary widget scope is what drew one person once per window: the broker hands every inbound frame to every app in the room, so each window claimed the pointer as its own. Deliberately about the scope, not the transport: a pointer with no key at all never comes through here and stays the window’s to paint.

pub fn pointer_default() -> PresenceKey

The canonical PresenceKey used to attribute a pointer publish that carries no explicit scope — the broker synthesises this well-known routing tag for the capnp publishCursor(x, y) path, which accepts no key of its own. Chosen as Widget { path: [] }: the empty widget path is unambiguously the “app root” scope (no live widget can occupy it), and its postcard encoding is stable and doesn’t depend on a string tag that could drift.

Trait Implementations§

§

impl Clone for PresenceKey

§

fn clone(&self) -> PresenceKey

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for PresenceKey

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for PresenceKey

§

fn deserialize<__D>( __deserializer: __D, ) -> Result<PresenceKey, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Hash for PresenceKey

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for PresenceKey

§

fn eq(&self, other: &PresenceKey) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for PresenceKey

§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl Eq for PresenceKey

§

impl StructuralPartialEq for PresenceKey

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> MaybeSendSync for T
where T: Send + Sync + ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSync for T
where T: Sync,