Skip to main content

KeyExprFormatter

Trait KeyExprFormatter 

Source
pub trait KeyExprFormatter {
    const ESCAPE_CHAR: char;
    const ADMIN_SPACE: &'static str;

    // Required methods
    fn topic_key_expr(entity: &EndpointEntity) -> Result<TopicKE>;
    fn liveliness_key_expr(
        entity: &EndpointEntity,
        zid: &ZenohId,
    ) -> Result<LivelinessKE>;
    fn node_liveliness_key_expr(entity: &NodeEntity) -> Result<LivelinessKE>;
    fn parse_liveliness(ke: &KeyExpr<'_>) -> Result<Entity>;
    fn encode_qos(qos: &QosProfile, keyless: bool) -> String;
    fn decode_qos(s: &str) -> Result<(bool, QosProfile)>;

    // Provided methods
    fn mangle_name(name: &str) -> String { ... }
    fn demangle_name(name: &str) -> String { ... }
}
Expand description

Trait for key expression format implementations.

This trait abstracts the differences between key expression formats used by different Zenoh-ROS bridges.

Required Associated Constants§

Source

const ESCAPE_CHAR: char

Escape character used to replace slashes in key expressions.

Source

const ADMIN_SPACE: &'static str

Admin space prefix for liveliness tokens.

Required Methods§

Source

fn topic_key_expr(entity: &EndpointEntity) -> Result<TopicKE>

Generate topic key expression for data publication/subscription.

Source

fn liveliness_key_expr( entity: &EndpointEntity, zid: &ZenohId, ) -> Result<LivelinessKE>

Generate liveliness token for endpoint entity discovery.

Source

fn node_liveliness_key_expr(entity: &NodeEntity) -> Result<LivelinessKE>

Generate liveliness token for node entity discovery.

Source

fn parse_liveliness(ke: &KeyExpr<'_>) -> Result<Entity>

Parse liveliness token back to entity.

Source

fn encode_qos(qos: &QosProfile, keyless: bool) -> String

Encode QoS for liveliness token.

Source

fn decode_qos(s: &str) -> Result<(bool, QosProfile)>

Decode QoS from liveliness token.

Provided Methods§

Source

fn mangle_name(name: &str) -> String

Mangle a name (replace slashes with escape char).

Source

fn demangle_name(name: &str) -> String

Demangle a name (restore slashes from escape char).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl KeyExprFormatter for RmwZenohFormatter

Source§

const ESCAPE_CHAR: char = '%'

Source§

const ADMIN_SPACE: &'static str = "@ros2_lv"

Source§

impl KeyExprFormatter for Ros2DdsFormatter

Source§

const ESCAPE_CHAR: char = SLASH_REPLACEMENT_CHAR

Source§

const ADMIN_SPACE: &'static str = "@ros2_lv"