pub struct Srv { /* private fields */ }Expand description
A ROS service parsed from a srv file.
Implementations§
Source§impl Srv
impl Srv
Sourcepub fn new(path: MessagePath, source: impl Into<String>) -> Result<Srv>
pub fn new(path: MessagePath, source: impl Into<String>) -> Result<Srv>
Create a service from a passed in path and source.
§Errors
Returns an error if there is an error parsing the service source.
§Examples
let service = Srv::new(
"foo/Bar".try_into()?,
r#"# a comment that is ignored
Header header
uint32 a
byte[16] b
geometry_msgs/Point[] point
uint32 FOO=5
string SOME_TEXT=this is # some text, don't be fooled by the hash
---
uint32 a
geometry_msgs/Point[] point
uint32 FOO=6
"#,
)?;
assert_eq!(service.path(), &"foo/Bar".try_into()?);
assert_eq!(service.request().fields().len(), 6);
assert_eq!(service.response().fields().len(), 3);Sourcepub fn path(&self) -> &MessagePath
pub fn path(&self) -> &MessagePath
Returns the path of the service.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Srv
impl<'de> Deserialize<'de> for Srv
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
impl Eq for Srv
impl StructuralPartialEq for Srv
Auto Trait Implementations§
impl Freeze for Srv
impl RefUnwindSafe for Srv
impl Send for Srv
impl Sync for Srv
impl Unpin for Srv
impl UnwindSafe for Srv
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§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