pub struct Node { /* private fields */ }Expand description
Node abstraction for Zenobuf
A Node is the main entry point for using Zenobuf. It provides methods for creating publishers, subscribers, services, and clients.
Implementations§
Source§impl Node
impl Node
Sourcepub const NODE_PREFIX: &str = "zenobuf/node/"
pub const NODE_PREFIX: &str = "zenobuf/node/"
Prefix for node discovery key expressions
Sourcepub async fn with_transport(
name: &str,
transport: ZenohTransport,
) -> Result<Self>
pub async fn with_transport( name: &str, transport: ZenohTransport, ) -> Result<Self>
Creates a new Node with the given name and transport
Sourcepub async fn create_publisher<M: Message>(
&self,
topic: &str,
qos: QosProfile,
) -> Result<Arc<Publisher<M>>>
pub async fn create_publisher<M: Message>( &self, topic: &str, qos: QosProfile, ) -> Result<Arc<Publisher<M>>>
Creates a publisher for the given topic
Sourcepub async fn create_subscriber<M: Message, F>(
&self,
topic: &str,
_qos: QosProfile,
callback: F,
) -> Result<Arc<Subscriber>>
pub async fn create_subscriber<M: Message, F>( &self, topic: &str, _qos: QosProfile, callback: F, ) -> Result<Arc<Subscriber>>
Creates a subscriber for the given topic with a callback
Sourcepub async fn create_service<Req: Message, Res: Message, F>(
&self,
service_name: &str,
handler: F,
) -> Result<Arc<Service>>
pub async fn create_service<Req: Message, Res: Message, F>( &self, service_name: &str, handler: F, ) -> Result<Arc<Service>>
Creates a service for the given name with a handler
Sourcepub fn create_client<Req: Message, Res: Message>(
&self,
service_name: &str,
) -> Result<Arc<Client<Req, Res>>>
pub fn create_client<Req: Message, Res: Message>( &self, service_name: &str, ) -> Result<Arc<Client<Req, Res>>>
Creates a client for the given service name
Sourcepub fn set_parameter<T: Serialize + DeserializeOwned + Clone + Send + Sync + 'static>(
&self,
name: &str,
value: T,
) -> Result<()>
pub fn set_parameter<T: Serialize + DeserializeOwned + Clone + Send + Sync + 'static>( &self, name: &str, value: T, ) -> Result<()>
Sets a parameter
Sourcepub fn get_parameter<T: DeserializeOwned + Clone + Send + Sync + 'static>(
&self,
name: &str,
) -> Result<T>
pub fn get_parameter<T: DeserializeOwned + Clone + Send + Sync + 'static>( &self, name: &str, ) -> Result<T>
Gets a parameter
Sourcepub fn spin_once(&self) -> Result<usize>
pub fn spin_once(&self) -> Result<usize>
Spins the node once, processing all pending callbacks
Returns the number of callbacks that were processed.
Sourcepub async fn spin(&self) -> Result<()>
pub async fn spin(&self) -> Result<()>
Spins the node, processing callbacks until the node is shutdown
This method will block until shutdown() is called on the node.
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Shuts down the node
This will cause spin() to return and prevent new callbacks from being queued.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Returns true if the node has been shutdown
Sourcepub fn publisher<M: Message>(&self, topic: &str) -> PublisherBuilder<'_, M>
pub fn publisher<M: Message>(&self, topic: &str) -> PublisherBuilder<'_, M>
Creates a publisher builder for the given topic
Sourcepub fn subscriber<M: Message>(&self, topic: &str) -> SubscriberBuilder<'_, M>
pub fn subscriber<M: Message>(&self, topic: &str) -> SubscriberBuilder<'_, M>
Creates a subscriber builder for the given topic
Sourcepub fn service<Req: Message, Res: Message>(
&self,
name: &str,
) -> ServiceBuilder<'_, Req, Res>
pub fn service<Req: Message, Res: Message>( &self, name: &str, ) -> ServiceBuilder<'_, Req, Res>
Creates a service builder for the given service name
Sourcepub fn client<Req: Message, Res: Message>(
&self,
name: &str,
) -> ClientBuilder<'_, Req, Res>
pub fn client<Req: Message, Res: Message>( &self, name: &str, ) -> ClientBuilder<'_, Req, Res>
Creates a client builder for the given service name
Auto Trait Implementations§
impl !Freeze for Node
impl !RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl !UnwindSafe for Node
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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