Skip to main content

CapabilityExt

Trait CapabilityExt 

Source
pub trait CapabilityExt {
    // Required methods
    fn new(
        id: String,
        name: String,
        capability_type: CapabilityType,
        confidence: f32,
    ) -> Self;
    fn get_capability_type(&self) -> CapabilityType;
    fn set_capability_type(&mut self, capability_type: CapabilityType);
    fn is_valid(&self, threshold: f32) -> bool;
}
Expand description

Extension trait for Capability with ergonomic constructors and accessors

Required Methods§

Source

fn new( id: String, name: String, capability_type: CapabilityType, confidence: f32, ) -> Self

Create a new capability

§Arguments
  • id - Unique capability identifier
  • name - Human-readable name
  • capability_type - Type of capability (sensor, compute, etc.)
  • confidence - Confidence score (0.0 - 1.0), will be clamped
Source

fn get_capability_type(&self) -> CapabilityType

Get the capability type as the enum (not i32)

Returns the CapabilityType enum value, converting from the protobuf i32 field. Returns Unspecified if the field contains an invalid value.

Source

fn set_capability_type(&mut self, capability_type: CapabilityType)

Set the capability type from the enum

§Arguments
  • capability_type - The CapabilityType enum value to set
Source

fn is_valid(&self, threshold: f32) -> bool

Check if this capability is valid (confidence > threshold)

§Arguments
  • threshold - Minimum confidence threshold (0.0 - 1.0)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§