pub struct EphemeralSubscription { /* private fields */ }Expand description
The ephemeral subscription of one WebSocket connection, normalized
from a ChatStreamEnable frame.
The default value subscribes to nothing, which is the state before the
first ChatStreamEnable and after a ChatStreamDisable.
Implementations§
Source§impl EphemeralSubscription
impl EphemeralSubscription
Sourcepub fn from_enable(
enable: &ChatStreamEnable,
companions: CompanionStreams,
) -> Result<Self, JmapError>
pub fn from_enable( enable: &ChatStreamEnable, companions: CompanionStreams, ) -> Result<Self, JmapError>
Validates and normalizes a ChatStreamEnable frame.
"typing" and "presence" in dataTypes always take effect.
"vtc" and "scene" take effect only when companions says the
server advertises their capability; otherwise they are unrecognized
(draft-atwood-jmap-chat-wss-00 §Enabling Ephemeral Push, L196: the
value “is treated as unrecognized and silently ignored”). Other
values are ignored. chatIds applies only when "typing" is
present and contactIds only when "presence" is present.
§Errors
Returns an invalidArguments JmapError when dataTypes holds
no recognized value: “none of "typing", "presence", or a
companion value whose capability the server advertises”
(draft-atwood-jmap-chat-wss-00 §Enabling Ephemeral Push, L194). The
transport sends it to the client as an RFC 8887 §4.3.4
RequestError frame whose type is the full URN
"urn:ietf:params:jmap:error:invalidArguments"; the returned
JmapError carries the short method-level name. When enable.id
is set, the transport MUST put it in the frame’s requestId: “A
RequestError caused by this message carries this value as its
requestId” (draft-atwood-jmap-chat-wss-00 §ChatStreamEnable, L186).
Sourcepub fn replace_with(
&mut self,
enable: &ChatStreamEnable,
companions: CompanionStreams,
) -> Result<(), JmapError>
pub fn replace_with( &mut self, enable: &ChatStreamEnable, companions: CompanionStreams, ) -> Result<(), JmapError>
Replaces this subscription with the one in enable.
The new frame replaces the old subscription in full; nothing is
merged from it (draft-atwood-jmap-chat-wss-00 §ChatStreamEnable).
§Errors
Returns the same error as Self::from_enable, which the transport
sends as a RequestError whose requestId is enable.id. On error
self is unchanged, as the draft requires.
Sourcepub fn typing(&self) -> Option<&IdScope>
pub fn typing(&self) -> Option<&IdScope>
The Chats covered for typing events, or None when typing is not
subscribed. IdScope::All means every Chat of which the owner is
a current member.
Sourcepub fn presence(&self) -> Option<&IdScope>
pub fn presence(&self) -> Option<&IdScope>
The ChatContacts covered for presence events, or None when
presence is not subscribed. IdScope::All means every known
ChatContact.
Trait Implementations§
Source§impl Clone for EphemeralSubscription
impl Clone for EphemeralSubscription
Source§impl Debug for EphemeralSubscription
impl Debug for EphemeralSubscription
Source§impl Default for EphemeralSubscription
impl Default for EphemeralSubscription
impl Eq for EphemeralSubscription
Source§impl PartialEq for EphemeralSubscription
impl PartialEq for EphemeralSubscription
impl StructuralPartialEq for EphemeralSubscription
Auto Trait Implementations§
impl Forget for EphemeralSubscription
impl Freeze for EphemeralSubscription
impl Move for EphemeralSubscription
impl RefUnwindSafe for EphemeralSubscription
impl Send for EphemeralSubscription
impl Sync for EphemeralSubscription
impl Unpin for EphemeralSubscription
impl UnsafeUnpin for EphemeralSubscription
impl UnwindSafe for EphemeralSubscription
Blanket Implementations§
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.