pub enum Phase {
Negotiating,
Connected,
Activated(ControlType),
}Expand description
Where a session has got to, as the state table sees it.
The standard’s own table has two rows — WebSocket Connected and
ControlType <X> activated — because under S2 Connect the version is settled before
the socket opens and there is nothing before the first row. A bare-WebSocket session
has one more: S2J messages/Handshake is exchanged first, and until it is, the two
sides have not agreed which schema the next message is to be read against.
Negotiating is that row. Leaving it out is what lets a
PowerMeasurement sent before the handshake — a message whose version nobody has
agreed — pass a check named after the state it is not in.
Variants§
Negotiating
Before the handshake has completed, on a session that has one.
Only Handshake, HandshakeResponse, SessionRequest and ReceptionStatus may
cross. A session under S2 Connect is never in this phase: session initiation
already agreed the version, and the handshake messages “can not be sent”.
Connected
WebSocketConnected, the standard’s first row.
Also where a session sits after NO_SELECTION or NOT_CONTROLABLE, which are a
deselection and a selection with nothing to instruct.
Activated(ControlType)
ControlTypeActivated, the standard’s per-control-type rows.
Implementations§
Source§impl Phase
impl Phase
Sourcepub fn selected(control_type: ControlType) -> Self
pub fn selected(control_type: ControlType) -> Self
The phase a control-type selection puts a session in.
NO_SELECTION and NOT_CONTROLABLE are Connected: the first
is a deselection, the second a legal selection after which nothing control-type
specific may flow (docs learn/examples/nocontrol).
Sourcepub const fn active_control_type(self) -> Option<ControlType>
pub const fn active_control_type(self) -> Option<ControlType>
The control type that is active, if one that can be instructed is.
Trait Implementations§
impl Copy for Phase
impl Eq for Phase
impl StructuralPartialEq for Phase
Auto Trait Implementations§
impl Forget for Phase
impl Freeze for Phase
impl Move for Phase
impl RefUnwindSafe for Phase
impl Send for Phase
impl Sync for Phase
impl Unpin for Phase
impl UnsafeUnpin for Phase
impl UnwindSafe for Phase
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.