pub fn is_valid_name(name: &str) -> boolExpand description
Returns whether a string is a valid ROS 2 topic or service name.
§Arguments
name- the candidate name.
§Returns
true if name obeys the ROS 2 name rules: non-empty, no trailing /, no // or __, every
token is alphanumerics and underscores not starting with a digit, any ~ is the first character
and (if anything follows) is followed by /, and any {} substitutions are balanced and hold
only alphanumerics and underscores.
§Examples
use pamoja_ros2::name::is_valid_name;
assert!(is_valid_name("/robot1/camera_left/image_raw"));
assert!(is_valid_name("~/setpoint"));
assert!(!is_valid_name("/2foo")); // a token may not start with a digit
assert!(!is_valid_name("/foo/")); // no trailing slash
assert!(!is_valid_name("/foo//bar")); // no empty token