pub struct Group { /* private fields */ }
Available on crate feature
service
only.Implementations§
source§impl Group
impl Group
sourcepub fn group<S: ToString>(&self, prefix: S) -> Group
pub fn group<S: ToString>(&self, prefix: S) -> Group
Creates a group for Endpoints under common prefix.
§Examples
use async_nats::service::ServiceExt;
let client = async_nats::connect("demo.nats.io").await?;
let mut service = client.service_builder().start("service", "1.0.0").await?;
let v1 = service.group("v1");
let products = v1.endpoint("products").await?;
sourcepub fn group_with_queue_group<S: ToString, Z: ToString>(
&self,
prefix: S,
queue_group: Z,
) -> Group
pub fn group_with_queue_group<S: ToString, Z: ToString>( &self, prefix: S, queue_group: Z, ) -> Group
Creates a group for Endpoints under common prefix with custom queue group.
§Examples
use async_nats::service::ServiceExt;
let client = async_nats::connect("demo.nats.io").await?;
let mut service = client.service_builder().start("service", "1.0.0").await?;
let v1 = service.group("v1");
let products = v1.endpoint("products").await?;
sourcepub async fn endpoint<S: ToString>(&self, subject: S) -> Result<Endpoint, Error>
pub async fn endpoint<S: ToString>(&self, subject: S) -> Result<Endpoint, Error>
Adds a new endpoint to the Service under current Group
§Examples
use async_nats::service::ServiceExt;
let client = async_nats::connect("demo.nats.io").await?;
let mut service = client.service_builder().start("service", "1.0.0").await?;
let v1 = service.group("v1");
let products = v1.endpoint("products").await?;
sourcepub fn endpoint_builder(&self) -> EndpointBuilder
pub fn endpoint_builder(&self) -> EndpointBuilder
Builder for customized Endpoint creation under current Group
§Examples
use async_nats::service::ServiceExt;
let client = async_nats::connect("demo.nats.io").await?;
let mut service = client.service_builder().start("service", "1.0.0").await?;
let v1 = service.group("v1");
let products = v1.endpoint_builder().name("api").add("products").await?;
Auto Trait Implementations§
impl Freeze for Group
impl !RefUnwindSafe for Group
impl Send for Group
impl Sync for Group
impl Unpin for Group
impl !UnwindSafe for Group
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