pub struct QoSPolicyMask(pub u32);Expand description
Bitmask of QoS policies a backend can honour. See
Session::supported_qos_policies.
One bit per value QoSProfile::required_policies can request, and that
function is the definition of what each bit MEANS — check-qos-mask- derivation reads the bit->field mapping out of its body rather than
restating it, so a policy that gains a bit here and no arm there is a gate
failure instead of a bit nothing can ever ask for.
Tuple Fields§
§0: u32Implementations§
Source§impl QoSPolicyMask
impl QoSPolicyMask
pub const RELIABILITY: Self
pub const DURABILITY_VOLATILE: Self
pub const DURABILITY_TRANSIENT_LOCAL: Self
pub const HISTORY: Self
pub const DEPTH: Self
pub const DEADLINE: Self
pub const LIFESPAN: Self
pub const LIVELINESS_AUTOMATIC: Self
pub const LIVELINESS_MANUAL_BY_TOPIC: Self
pub const LIVELINESS_MANUAL_BY_NODE: Self
pub const LIVELINESS_LEASE: Self
pub const AVOID_ROS_NAMESPACE_CONVENTIONS: Self
Sourcepub const NONE: Self
pub const NONE: Self
Honours nothing. The default answer for an implementation that has not
said otherwise — phase-428 W9, see Session::supported_qos_policies.
Sourcepub const CORE: Self
pub const CORE: Self
The four policies every QoSProfile states a value for.
NOT “policies every nano-ros backend implements”, which is what this said until phase-428 W9 measured it: the zenoh shim honoured exactly none of the four, serialising all four into a discovery keyexpr and enforcing a build-time ring depth. The name describes the SHAPE of a profile — a caller who states nothing else still states these — and a backend still has to earn each bit.
Sourcepub const NAMED: &'static [(Self, &'static CStr)]
pub const NAMED: &'static [(Self, &'static CStr)]
Every policy bit paired with the name it PRINTS — the vocabulary the
three languages name a refused policy in (phase-417 G7, ledger row
cpp:qos_policy_kind_to_cstr).
The name of a bit is the CONSTANT’S OWN IDENTIFIER, never an
independently chosen word. That is what keeps this from becoming the
parallel table this campaign has paid for twice — the RMW parity map’s
28 stale slots and the layout gate’s three authored type names — and it
is what check-qos-mask-derivation’s R8 measures: the entries here must
be exactly the pub const … = Self(1 << n) bits above, each paired with
its own spelling. A bit added above and not here is a gate failure, not
a policy that silently prints as nothing.
Uppercase because that is upstream’s convention for the same strings:
rclcpp::qos_policy_kind_to_cstr returns "DURABILITY", "DEADLINE",
"LIVELINESS" and the rest.
NONE and CORE are deliberately absent: they are not policies, they
are the empty mask and a named union, and neither can be the answer to
“which policy was refused”.
The name is stored as a core::ffi::CStr and not as a &str,
because the C entry point (rclc_qos_policy_kind_to_cstr) needs the
trailing NUL and a &str does not carry one. Storing the &str form
and NUL-terminating it in nros-c was the first shape here, and it put
the twelve identifiers in a second file — which is the drift this row
exists to avoid. One table, two readings: policy_name slices the NUL
off for Rust, the C entry point hands the pointer straight over.
Sourcepub const fn policy_name_cstr(self) -> Option<&'static CStr>
pub const fn policy_name_cstr(self) -> Option<&'static CStr>
The name of the ONE policy this mask is, as a C string.
None for the empty mask and for a mask carrying more than one bit:
both are real answers a diagnostic must be able to give. “The backend
did not say which” is not a policy name, and printing a neighbouring
one would be the plausible wrong answer this whole family exists to
refuse.
Borrowed from a table in flash: no allocator, no formatting, reaches a bare-metal target, and these are the exact bytes the C and C++ entry points hand back.
Sourcepub fn policy_name(self) -> Option<&'static str>
pub fn policy_name(self) -> Option<&'static str>
Self::policy_name_cstr as a Rust string — the same bytes without
the terminator.
Sourcepub const fn missing_from(self, supported: Self) -> Self
pub const fn missing_from(self, supported: Self) -> Self
The policies in self that supported does not carry.
Sourcepub const fn lowest_policy(self) -> Self
pub const fn lowest_policy(self) -> Self
The lowest-numbered policy bit set here, or Self::NONE.
Which single policy a multi-policy refusal REPORTS. Lowest bit rather than “any”: a stable choice means the same profile against the same backend names the same policy on every run and in every language, so a test can assert it and two surfaces cannot disagree about which one to mention first.
Trait Implementations§
Source§impl BitOr for QoSPolicyMask
impl BitOr for QoSPolicyMask
Source§impl BitOrAssign for QoSPolicyMask
impl BitOrAssign for QoSPolicyMask
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moreSource§impl Clone for QoSPolicyMask
impl Clone for QoSPolicyMask
Source§fn clone(&self) -> QoSPolicyMask
fn clone(&self) -> QoSPolicyMask
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more