Skip to main content

check

Function check 

Source
pub fn check(
    type_name: &str,
    topic: &str,
    qos: &QoSProfile,
) -> Result<(), NodeError>
Expand description

Refuse a subscription whose QoS disagrees with what the contract declared for its topic – its depth, and (issue 1256) its reliability and durability.

Ok(()) when every declared column agrees AND when nothing was declared – an image that has not opted in is not an image in error. On a disagreement the TOPIC and BOTH values go to the log first (a NodeError is a unit variant and can carry none of the three), then the registration is refused: NodeError::DeclaredDepthMismatch for the depth, NodeError::DeclaredQosMismatch for a policy.

Reached from the C and C++ FFI registration seams, which have already taken the declared QoS at their own call site (NROS_SUBSCRIBE’s three-argument form → qos_from_declared; C’s _Static_assert), so a disagreement arriving here is a real one. The Rust seams call honour instead — see its doc comment for why the two surfaces differ.

§Keep the message inside ONE log line

nros_log’s formatting buffer is 256 bytes by default (NROS_LOG_BUFFER_SIZE) and OVERFLOW TRUNCATES with a single …. This message used to run past 450 characters, so on a real image the half a reader needs — which file to edit — was the half that got cut, and the diagnostic ended mid-sentence. The numbers and the topic come first for the same reason: a long type name may still push the tail off, and the tail is the least load-bearing part.