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
path: Vec<PathSegment>Tab
Workspace
App
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.
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
space: PointerSpaceResource
Stable action resource scope. It deliberately carries no pixels: the
receiving app resolves id against its own live layout.
Implementations§
§impl PresenceKey
impl PresenceKey
pub fn widget(path: &[PathSegment]) -> Option<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]>
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
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>
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
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>
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>
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
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
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
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
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>
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
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
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
impl Clone for PresenceKey
§fn clone(&self) -> PresenceKey
fn clone(&self) -> PresenceKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for PresenceKey
impl Debug for PresenceKey
§impl<'de> Deserialize<'de> for PresenceKey
impl<'de> Deserialize<'de> for PresenceKey
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PresenceKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PresenceKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Hash for PresenceKey
impl Hash for PresenceKey
§impl PartialEq for PresenceKey
impl PartialEq for PresenceKey
§impl Serialize for PresenceKey
impl Serialize for PresenceKey
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for PresenceKey
impl StructuralPartialEq for PresenceKey
Auto Trait Implementations§
impl Freeze for PresenceKey
impl RefUnwindSafe for PresenceKey
impl Send for PresenceKey
impl Sync for PresenceKey
impl Unpin for PresenceKey
impl UnsafeUnpin for PresenceKey
impl UnwindSafe for PresenceKey
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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