pub struct Service<T>where
T: Service,{
pub callback: Mutex<Box<dyn Fn(&rmw_request_id_t, T::Request) -> T::Response + Send + 'static>>,
/* private fields */
}
Expand description
Main class responsible for responding to requests sent by ROS clients.
The only available way to instantiate services is via Node::create_service()
, this is to
ensure that Node
s can track all the services that have been created.
Fields§
§callback: Mutex<Box<dyn Fn(&rmw_request_id_t, T::Request) -> T::Response + Send + 'static>>
The callback function that runs when a request was received.
Implementations§
Source§impl<T> Service<T>where
T: Service,
impl<T> Service<T>where
T: Service,
Sourcepub fn take_request(&self) -> Result<(T::Request, rmw_request_id_t), RclrsError>
pub fn take_request(&self) -> Result<(T::Request, rmw_request_id_t), RclrsError>
Fetches a new request.
When there is no new message, this will return a
ServiceTakeFailed
.
Trait Implementations§
Source§impl<T> ServiceBase for Service<T>where
T: Service,
impl<T> ServiceBase for Service<T>where
T: Service,
Source§fn handle(&self) -> &ServiceHandle
fn handle(&self) -> &ServiceHandle
Internal function to get a reference to the
rcl
handle.Auto Trait Implementations§
impl<T> !Freeze for Service<T>
impl<T> RefUnwindSafe for Service<T>
impl<T> Send for Service<T>
impl<T> Sync for Service<T>
impl<T> Unpin for Service<T>
impl<T> UnwindSafe for Service<T>
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