Struct ros_message::Srv
source · 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§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