Skip to main content

percent_mangle

Function percent_mangle 

Source
pub fn percent_mangle(name: &str) -> String
Expand description

Mangles a name by replacing each / with %, as rmw_zenoh does in liveliness tokens.

§Arguments

  • name - the name to mangle.

§Returns

The name with every / replaced by %, for example /chatter becomes %chatter.

§Examples

use pamoja_ros2::name::percent_mangle;

assert_eq!(percent_mangle("/chatter"), "%chatter");
assert_eq!(percent_mangle("/robot1/chatter"), "%robot1%chatter");