Struct ros_message::MessagePath
source · pub struct MessagePath { /* private fields */ }
Expand description
Path to a ROS message with naming conventions tested.
Implementations§
source§impl MessagePath
impl MessagePath
sourcepub fn new(package: impl Into<String>, name: impl Into<String>) -> Result<Self>
pub fn new(package: impl Into<String>, name: impl Into<String>) -> Result<Self>
Create full message path, with naming rules checked
Naming rules are based on REP 144.
§Errors
An error will be returned if naming conventions are not met.
§Examples
let message_path = MessagePath::new("foo", "Bar")?;
assert_eq!(message_path.package(), "foo");
assert_eq!(message_path.name(), "Bar");
assert!(MessagePath::new("0foo", "Bar").is_err());
sourcepub fn peer(&self, name: impl Into<String>) -> Self
pub fn peer(&self, name: impl Into<String>) -> Self
Create a new message path inside the same package.
Prevents the need for constant error checking of package names.
§Examples
let message_path = MessagePath::new("foo", "Bar")?.peer("Baz");
assert_eq!(message_path.package(), "foo");
assert_eq!(message_path.name(), "Baz");
Trait Implementations§
source§impl Clone for MessagePath
impl Clone for MessagePath
source§fn clone(&self) -> MessagePath
fn clone(&self) -> MessagePath
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for MessagePath
impl Debug for MessagePath
source§impl<'de> Deserialize<'de> for MessagePath
impl<'de> Deserialize<'de> for MessagePath
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for MessagePath
impl Display for MessagePath
source§impl From<MessagePath> for String
impl From<MessagePath> for String
source§fn from(src: MessagePath) -> Self
fn from(src: MessagePath) -> Self
Converts to this type from the input type.
source§impl Hash for MessagePath
impl Hash for MessagePath
source§impl PartialEq for MessagePath
impl PartialEq for MessagePath
source§impl Serialize for MessagePath
impl Serialize for MessagePath
source§impl<'a> TryFrom<&'a str> for MessagePath
impl<'a> TryFrom<&'a str> for MessagePath
impl Eq for MessagePath
impl StructuralPartialEq for MessagePath
Auto Trait Implementations§
impl Freeze for MessagePath
impl RefUnwindSafe for MessagePath
impl Send for MessagePath
impl Sync for MessagePath
impl Unpin for MessagePath
impl UnwindSafe for MessagePath
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more