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: QoSPolicyMask
pub const DURABILITY_VOLATILE: QoSPolicyMask
pub const DURABILITY_TRANSIENT_LOCAL: QoSPolicyMask
pub const HISTORY: QoSPolicyMask
pub const DEPTH: QoSPolicyMask
pub const DEADLINE: QoSPolicyMask
pub const LIFESPAN: QoSPolicyMask
pub const LIVELINESS_AUTOMATIC: QoSPolicyMask
pub const LIVELINESS_MANUAL_BY_TOPIC: QoSPolicyMask
pub const LIVELINESS_MANUAL_BY_NODE: QoSPolicyMask
pub const LIVELINESS_LEASE: QoSPolicyMask
pub const AVOID_ROS_NAMESPACE_CONVENTIONS: QoSPolicyMask
Sourcepub const NONE: QoSPolicyMask
pub const NONE: QoSPolicyMask
Honours nothing. The default answer for an implementation that has not
said otherwise — phase-428 W9, see Session::supported_qos_policies.
Sourcepub const CORE: QoSPolicyMask
pub const CORE: QoSPolicyMask
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 [(QoSPolicyMask, &'static CStr)]
pub const NAMED: &'static [(QoSPolicyMask, &'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: QoSPolicyMask) -> QoSPolicyMask
pub const fn missing_from(self, supported: QoSPolicyMask) -> QoSPolicyMask
The policies in self that supported does not carry.
Sourcepub const fn lowest_policy(self) -> QoSPolicyMask
pub const fn lowest_policy(self) -> QoSPolicyMask
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.
Sourcepub const fn contains(self, other: QoSPolicyMask) -> bool
pub const fn contains(self, other: QoSPolicyMask) -> bool
true if self contains every policy in other.
Sourcepub const fn union(self, other: QoSPolicyMask) -> QoSPolicyMask
pub const fn union(self, other: QoSPolicyMask) -> QoSPolicyMask
Bitwise OR of two masks.
Trait Implementations§
Source§impl BitOr for QoSPolicyMask
impl BitOr for QoSPolicyMask
Source§type Output = QoSPolicyMask
type Output = QoSPolicyMask
| operator.Source§fn bitor(self, rhs: QoSPolicyMask) -> QoSPolicyMask
fn bitor(self, rhs: QoSPolicyMask) -> QoSPolicyMask
| operation. Read moreSource§impl BitOrAssign for QoSPolicyMask
impl BitOrAssign for QoSPolicyMask
Source§fn bitor_assign(&mut self, rhs: QoSPolicyMask)
fn bitor_assign(&mut self, rhs: QoSPolicyMask)
|= 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