ClientMsg

Enum ClientMsg 

Source
pub enum ClientMsg {
    Hello {
        sub: String,
        seq: Option<u64>,
        actor: String,
        path: String,
    },
    Cmd {
        id: String,
        command: Value,
    },
    Nav {
        path: String,
    },
    Ping,
}

Variants§

§

Hello

Subscribe, or resume.

seq is what this client holds, and its absence is meaningful: None is “I have nothing, send me the world” and Some(n) is “I hold the frame as of n” — including Some(0), which is what a browser says when the document it is running in was rendered from an empty log. Those were the same message until a browser ran the thin client and the first paint rebuilt the page it had just been served (docs/94 §94.13): position zero and nothing-at-all are different facts, and a protocol that spells them the same way cannot keep §5.1’s “first paint is free” promise.

Fields

§actor: String

What the client says it is. A claim, not an actor: beck_rt::identity is what turns it into one, and under DevIdentity the two are the same value — which is a choice an operator makes rather than a property of the protocol (docs/48).

§path: String

Where this client is, as a route. Absent means the application’s root.

On the hello rather than only in a ClientMsg::Nav because a subscription is re-established after every disconnection, and a client whose route were established by a separate frame would render one page for as long as the two frames were in flight — and would render the wrong page for as long as it took the second one to be resent after a reload with the network down.

§

Cmd

A proposal. id is the idempotency key that makes a retry after a reconnect safe (§4.3).

Fields

§command: Value
§

Nav

The client is somewhere else now.

It travels on the same socket as the commands, which is the whole of the ordering argument: a command proposed from a page is preceded by the navigation that produced that page, so the Session the server hands validate is the one the client’s own copy of validate saw. Nothing had to be added to the command frame to make that true.

Fields

§path: String
§

Ping

Implementations§

Trait Implementations§

Source§

impl Clone for ClientMsg

Source§

fn clone(&self) -> ClientMsg

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientMsg

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ClientMsg

Source§

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

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

impl PartialEq for ClientMsg

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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.
Source§

impl StructuralPartialEq for ClientMsg

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
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
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> Same for T

Source§

type Output = T

Should always be Self
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> 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>,