pub struct ParameterDescriptor {
pub name: String<nros_params::::types::ParameterDescriptor::{constant#0}>,
pub param_type: ParameterType,
pub description: String<nros_params::::types::ParameterDescriptor::{constant#1}>,
pub additional_constraints: String<nros_params::::types::ParameterDescriptor::{constant#2}>,
pub read_only: bool,
pub dynamic_typing: bool,
pub range: ParameterRange,
/* private fields */
}Expand description
Parameter descriptor containing metadata
Describes a parameter including its type, constraints, and documentation.
Fields§
§name: String<nros_params::::types::ParameterDescriptor::{constant#0}>Parameter name
param_type: ParameterTypeParameter type
description: String<nros_params::::types::ParameterDescriptor::{constant#1}>Human-readable description.
phase-446 F2 – its own capacity, NROS_MAX_PARAM_DESCRIPTION_LEN. It
used to share MAX_STRING_VALUE_LEN, which the contract derives to 0
for an image with no string parameter, so such an image could carry no
description at all. Write it with Self::set_description, which
truncates and records the truncation instead of dropping the text.
additional_constraints: String<nros_params::::types::ParameterDescriptor::{constant#2}>Free-text extra constraints — rcl_interfaces/msg/ParameterDescriptor’s
additional_constraints, which ros2 param describe prints.
phase-417 W4.a — its own capacity, NROS_MAX_PARAM_CONSTRAINTS_LEN,
default 0. Sharing the description’s knob was the first shape and
the derived service buffer measured it wrong: the describe reply’s
bound is a worst case over CAPACITY, not over use, so every image would
have paid 256 bytes per parameter for a field it never sets — 2,048
bytes on the eight-parameter island, taking its reply past the 4,096
fallback. An image that wants constraint text states the knob. Write it
with Self::set_additional_constraints, which truncates at a
character boundary and records the truncation exactly as the
description does, so a value that does not fit is reported rather than
dropped in silence.
read_only: boolWhether the parameter is read-only
dynamic_typing: boolWhether the parameter type can change dynamically
range: ParameterRangeRange constraints
Implementations§
Source§impl ParameterDescriptor
impl ParameterDescriptor
Sourcepub fn new(name: &str, param_type: ParameterType) -> Option<ParameterDescriptor>
pub fn new(name: &str, param_type: ParameterType) -> Option<ParameterDescriptor>
Create a new parameter descriptor
Sourcepub fn with_description(self, desc: &str) -> ParameterDescriptor
pub fn with_description(self, desc: &str) -> ParameterDescriptor
Set the description. A description longer than
NROS_MAX_PARAM_DESCRIPTION_LEN is truncated at a character boundary
and recorded (see Self::set_description).
Sourcepub fn set_description(&mut self, desc: &str) -> bool
pub fn set_description(&mut self, desc: &str) -> bool
phase-446 F2 – set the description, truncating at a character
boundary when it is longer than NROS_MAX_PARAM_DESCRIPTION_LEN.
Returns whether it was truncated; the descriptor also remembers it, so
the executor can report it once the parameter is declared.
Sourcepub fn description_truncated(&self) -> bool
pub fn description_truncated(&self) -> bool
Whether the last description set was truncated and not yet reported.
Sourcepub fn set_additional_constraints(&mut self, text: &str) -> bool
pub fn set_additional_constraints(&mut self, text: &str) -> bool
phase-417 W4.a — rclc’s additional_constraints, the fourth argument of
rclc_add_parameter_description. Truncated and recorded like the
description; returns whether anything was cut.
Sourcepub fn with_additional_constraints(self, text: &str) -> ParameterDescriptor
pub fn with_additional_constraints(self, text: &str) -> ParameterDescriptor
Builder form of Self::set_additional_constraints.
Sourcepub fn with_read_only(self, read_only: bool) -> ParameterDescriptor
pub fn with_read_only(self, read_only: bool) -> ParameterDescriptor
Set read-only flag
Sourcepub fn with_dynamic_typing(self, dynamic: bool) -> ParameterDescriptor
pub fn with_dynamic_typing(self, dynamic: bool) -> ParameterDescriptor
Set dynamic typing flag
Sourcepub fn with_integer_range(
self,
min: i64,
max: i64,
step: i64,
) -> ParameterDescriptor
pub fn with_integer_range( self, min: i64, max: i64, step: i64, ) -> ParameterDescriptor
Set integer range constraints
Sourcepub fn with_float_range(
self,
min: f64,
max: f64,
step: f64,
) -> ParameterDescriptor
pub fn with_float_range( self, min: f64, max: f64, step: f64, ) -> ParameterDescriptor
Set floating point range constraints
Sourcepub fn validate_range(&self, value: &ParameterValue) -> bool
pub fn validate_range(&self, value: &ParameterValue) -> bool
Check if a value satisfies the range constraints — min, max AND step.
Forwards to ParameterRange::contains, the single predicate.
Trait Implementations§
Source§impl Clone for ParameterDescriptor
impl Clone for ParameterDescriptor
Source§fn clone(&self) -> ParameterDescriptor
fn clone(&self) -> ParameterDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more