pub struct SurfaceCaps {
pub client_id: String,
pub preset: Symbol,
pub display: Expr,
pub input: Expr,
pub transport: Expr,
pub privacy: Expr,
pub codecs: Vec<Symbol>,
}Expand description
A surface’s advertised capabilities, as open metadata over Expr.
The four capability maps (display, input, transport, privacy) are
open: a surface may carry fields beyond the well-known ones, and the ranker
reads only the fields it understands. codecs lists the surface codecs the
client can decode (lisp/json/bin/…).
Fields§
§client_id: StringA stable client identifier, e.g. "tty.local.1".
preset: SymbolThe preset name this surface is based on (surface/<preset>).
display: ExprDisplay capabilities: cells/pixels, color, density, motion, budget.
input: ExprInput capabilities: keyboard/pointer/touch/voice/camera/tap/…
transport: ExprTransport capabilities: kind, round-trip, offline queue, ordering.
privacy: ExprPrivacy policy: redaction class, retention, private fields.
codecs: Vec<Symbol>Surface codecs the client can decode, in preference order.
Implementations§
Source§impl SurfaceCaps
impl SurfaceCaps
Sourcepub fn from_preset(
preset_name: &str,
client_id: impl Into<String>,
) -> Option<Self>
pub fn from_preset( preset_name: &str, client_id: impl Into<String>, ) -> Option<Self>
Builds caps from a preset name plus a concrete client_id.
Returns None when preset_name is not in SURFACE_PRESETS.
Sourcepub fn from_expr(expr: &Expr) -> Result<Self, SurfaceError>
pub fn from_expr(expr: &Expr) -> Result<Self, SurfaceError>
Parses caps from a surface/caps tagged Expr map, failing closed.
Sourcepub fn preset_name(&self) -> &str
pub fn preset_name(&self) -> &str
Returns the unqualified preset name (cli, watch, …).
Sourcepub fn input_flag(&self, name: &str) -> bool
pub fn input_flag(&self, name: &str) -> bool
Reads a boolean input capability flag, defaulting to false.
Sourcepub fn display_density(&self) -> Option<Symbol>
pub fn display_density(&self) -> Option<Symbol>
Reads the display density symbol (glance/compact/regular/dense).
Sourcepub fn accepts_codec(&self, codec: &str) -> bool
pub fn accepts_codec(&self, codec: &str) -> bool
Whether this surface can decode the named surface codec.
Trait Implementations§
Source§impl Clone for SurfaceCaps
impl Clone for SurfaceCaps
Source§fn clone(&self) -> SurfaceCaps
fn clone(&self) -> SurfaceCaps
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SurfaceCaps
impl Debug for SurfaceCaps
Source§impl PartialEq for SurfaceCaps
impl PartialEq for SurfaceCaps
Source§fn eq(&self, other: &SurfaceCaps) -> bool
fn eq(&self, other: &SurfaceCaps) -> bool
self and other values to be equal, and is used by ==.