pub enum Capability {
SpawnArgs,
PaneYurai,
Freio,
}Expand description
One named thing a daemon build can do. Each variant names a field or a behaviour a caller can gate on — never a release, never a date.
The wire form is a string, deliberately: a client that meets a daemon advertising a capability from a newer vocabulary must ignore the name it doesn’t know, not fail to decode the frame. Strings make that free; a serialized enum would make it a hard error.
Variants§
SpawnArgs
The daemon reads the args field on Request::NewSession,
Request::NewWindow and Request::SplitPane, and passes it
to the child as argv[1..].
A daemon without this reads the request fine — args is
#[serde(default)] and no type sets deny_unknown_fields,
so the key is simply dropped — and spawns the bare program.
That silent drop is the failure this whole module exists to
convert into a legible refusal.
PaneYurai
The daemon stamps TearPane::yurai at spawn from the connection’s
shutai, so a pane records WHAT KIND of actor created it.
Gates provenance READS (tear list showing which panes an agent
drives) and is useful with or without a brake. A daemon without it
reports every pane as Yurai::Unknown — which is honest, and is
also exactly why freio cannot brake Unknown.
Freio
The daemon reads Request::SetFreio / Request::GetFreio.
Independent of PaneYurai in one direction only: freio WITHOUT
yurai is meaningless (nothing to filter on), yurai without freio is
useful on its own. They ship in that order and a client can tell.
This capability is the reason a panic button cannot fail silently:
an old daemon would drop SetFreio as an unknown variant and
answer a legible Rejected, but the CLI must require() it FIRST
so the operator sees a typed refusal rather than a wire error on
the one command where “nothing happened” is unacceptable.
Implementations§
Source§impl Capability
impl Capability
Sourcepub const ALL: &'static [Capability]
pub const ALL: &'static [Capability]
Every capability name this build’s vocabulary knows. Not the
same thing as what a given daemon advertises — see
Capability::advertised.
Sourcepub fn wire_name(self) -> &'static str
pub fn wire_name(self) -> &'static str
The on-wire name. Kebab-case, names the field or behaviour.
Sourcepub fn from_wire(s: &str) -> Option<Self>
pub fn from_wire(s: &str) -> Option<Self>
Parse a wire name back to a typed capability. None for a
name from a vocabulary this build doesn’t have — which is the
expected outcome when an older client meets a newer daemon,
and must stay a quiet miss rather than an error.
Sourcepub fn advertised(self) -> bool
pub fn advertised(self) -> bool
Does this build of the daemon implement the capability?
The exhaustive match is the seal: adding a Capability
variant without deciding this is error[E0004]: non-exhaustive patterns, so no capability can land unclassified.
Trait Implementations§
Source§impl Clone for Capability
impl Clone for Capability
Source§fn clone(&self) -> Capability
fn clone(&self) -> Capability
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more