Struct ros2_client::Context
source · [−]pub struct Context { /* private fields */ }
Expand description
Context communicates with other
participants information in ROS2 network. It keeps track of
NodeEntitiesInfo
s. Also acts as a wrapper for a RustDDS instance.
Context is shut down by dropping it, and all of its RosNodes.
There should be no need for ok()
or shutdown()
methods.
Implementations
sourceimpl Context
impl Context
pub fn new() -> Result<Context, Error>
pub fn from_domain_participant(
domain_participant: DomainParticipant
) -> Result<Context, Error>
sourcepub fn new_node(
&self,
name: &str,
namespace: &str,
options: NodeOptions
) -> Result<Node, Error>
pub fn new_node(
&self,
name: &str,
namespace: &str,
options: NodeOptions
) -> Result<Node, Error>
Create a new ROS2 node
pub fn create_publisher<M>(
&self,
topic: &Topic,
qos: Option<QosPolicies>
) -> Result<Publisher<M>> where
M: Serialize,
pub fn create_subscription<M>(
&self,
topic: &Topic,
qos: Option<QosPolicies>
) -> Result<Subscription<M>> where
M: 'static + DeserializeOwned,
pub fn handle_node_read(&mut self) -> Vec<ParticipantEntitiesInfo>
pub fn domain_id(&self) -> u16
pub fn discovered_topics(&self) -> Vec<DiscoveredTopicData>
pub fn add_node_info(&mut self, node_info: NodeEntitiesInfo)
pub fn remove_node_info(&mut self, node_info: &NodeEntitiesInfo)
pub fn get_all_discovered_external_ros_node_infos(
&self
) -> HashMap<Gid, Vec<NodeEntitiesInfo>>
pub fn get_all_discovered_local_ros_node_infos(
&self
) -> HashMap<String, NodeEntitiesInfo>
sourcepub fn get_ros_participant_info(&self) -> ParticipantEntitiesInfo
pub fn get_ros_participant_info(&self) -> ParticipantEntitiesInfo
Gets our current participant info we have sent to ROS2 network
pub fn get_parameter_events_topic(&self) -> Topic
pub fn get_rosout_topic(&self) -> Topic
pub fn domain_participant(&self) -> DomainParticipant
Trait Implementations
sourceimpl Evented for Context
impl Evented for Context
sourcefn register(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt
) -> Result<()>
fn register(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt
) -> Result<()>
Register self
with the given Poll
instance. Read more
Auto Trait Implementations
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more