pub struct CapabilityViews<'a> { /* private fields */ }Expand description
Lazy borrowing handle exposing the five typed projections of a
CapabilitySet.
Returned by CapabilitySet::views. Each projection is decoded
from the canonical tag set on first access and cached for the
lifetime of the handle:
let caps = CapabilitySet::default();
let v = caps.views();
let _ = v.hardware(); // first read: decodes hardware tags
let _ = v.hardware(); // cached; no re-decode
let _ = v.models(); // separate cache; decodes model tagsPhase 1 of CAPABILITY_ENHANCEMENTS_PLAN.md: callers that
previously read views.hardware (field) now call
views.hardware() (accessor). Hot-path post-cache cost is a
single pointer load (OnceCell::get); pre-cache cost is one
invocation of the underlying *_from_tags decoder.
Implementations§
Source§impl<'a> CapabilityViews<'a>
impl<'a> CapabilityViews<'a>
Sourcepub fn hardware(&self) -> &HardwareCapabilities
pub fn hardware(&self) -> &HardwareCapabilities
Hardware projection. Decodes the hardware.* axis tags
(excluding hardware.limits.*) on first call; subsequent
calls return the cached projection.
Sourcepub fn software(&self) -> &SoftwareCapabilities
pub fn software(&self) -> &SoftwareCapabilities
Software projection. Decodes the software.* axis tags
(excluding software.model.* and software.tool.*) on
first call.
Sourcepub fn resource_limits(&self) -> &ResourceLimits
pub fn resource_limits(&self) -> &ResourceLimits
Resource-limits projection. Decodes the hardware.limits.*
tags on first call.
Sourcepub fn models(&self) -> &Vec<ModelCapability>
pub fn models(&self) -> &Vec<ModelCapability>
Loaded-model projection. Decodes the software.model.<i>.*
indexed tags on first call.
Sourcepub fn tools(&self) -> &Vec<ToolCapability>
pub fn tools(&self) -> &Vec<ToolCapability>
Available-tool projection. Decodes the software.tool.<i>.*
indexed tags on first call AND layers tool input/output JSON
Schemas back from caps.metadata (key shape:
tool::<id>::input_schema / tool::<id>::output_schema).