Struct cometd_client::CometdClientBuilder
source · pub struct CometdClientBuilder<'a, 'b, 'c, 'd, 'e> { /* private fields */ }
Expand description
A builder to construct CometdClient
.
Implementations§
source§impl<'a, 'b, 'c, 'd, 'e> CometdClientBuilder<'a, 'b, 'c, 'd, 'e>
impl<'a, 'b, 'c, 'd, 'e> CometdClientBuilder<'a, 'b, 'c, 'd, 'e>
sourcepub fn build<Msg>(self) -> CometdResult<CometdClient<Msg>>where
Msg: DeserializeOwned + Send + Sync + 'static,
pub fn build<Msg>(self) -> CometdResult<CometdClient<Msg>>where Msg: DeserializeOwned + Send + Sync + 'static,
Return a CometdClient
.
Example
let client = CometdClientBuilder::new(&"http://[::1]:1025/notifications/".parse()?)
.build()?;
sourcepub const fn handshake_base_path(self, url: &'b str) -> Self
pub const fn handshake_base_path(self, url: &'b str) -> Self
Set cometd server handshake url path.
Example
let client = CometdClientBuilder::new(&"http://[::1]:1025/notifications/".parse()?)
.handshake_base_path("hand/") // http://[::1]:1025/notifications/hand/handshake
.build()?;
sourcepub const fn subscribe_base_path(self, url: &'c str) -> Self
pub const fn subscribe_base_path(self, url: &'c str) -> Self
Set cometd server subscribe url path.
Example
let client = CometdClientBuilder::new(&"http://[::1]:1025/notifications/".parse()?)
.subscribe_base_path("sub/") // http://[::1]:1025/notifications/sub/
.build()?;
sourcepub const fn connect_base_path(self, url: &'d str) -> Self
pub const fn connect_base_path(self, url: &'d str) -> Self
Set cometd server connect url path.
Example
let client = CometdClientBuilder::new(&"http://[::1]:1025/notifications/".parse()?)
.connect_base_path("con/") // http://[::1]:1025/notifications/con/connect
.build()?;
sourcepub const fn disconnect_base_path(self, url: &'e str) -> Self
pub const fn disconnect_base_path(self, url: &'e str) -> Self
Set cometd server disconnect url path.
Example
let client = CometdClientBuilder::new(&"http://[::1]:1025/notifications/".parse()?)
.disconnect_base_path("con/") // http://[::1]:1025/notifications/discon/disconnect
.build()?;
sourcepub const fn interval(self, interval: Duration) -> Self
pub const fn interval(self, interval: Duration) -> Self
Set interval
option in handshake request.
sourcepub fn access_token(self, access_token: impl AccessToken) -> Self
pub fn access_token(self, access_token: impl AccessToken) -> Self
Set access token
option in handshake request.
Set cookie
.
Set cookies
.
sourcepub const fn events_channel_capacity(
self,
events_channel_capacity: usize
) -> Self
pub const fn events_channel_capacity( self, events_channel_capacity: usize ) -> Self
Set capacity of Event
channel.
sourcepub const fn commands_channel_capacity(
self,
commands_channel_capacity: usize
) -> Self
pub const fn commands_channel_capacity( self, commands_channel_capacity: usize ) -> Self
Set capacity of internal commands channel.
sourcepub const fn number_of_retries(self, number_of_retries: usize) -> Self
pub const fn number_of_retries(self, number_of_retries: usize) -> Self
Set number of retries for requests.
sourcepub const fn request_timeout(self, request_timeout: Duration) -> Self
pub const fn request_timeout(self, request_timeout: Duration) -> Self
Set requests timeout.
Trait Implementations§
Auto Trait Implementations§
impl<'a, 'b, 'c, 'd, 'e> !RefUnwindSafe for CometdClientBuilder<'a, 'b, 'c, 'd, 'e>
impl<'a, 'b, 'c, 'd, 'e> Send for CometdClientBuilder<'a, 'b, 'c, 'd, 'e>
impl<'a, 'b, 'c, 'd, 'e> Sync for CometdClientBuilder<'a, 'b, 'c, 'd, 'e>
impl<'a, 'b, 'c, 'd, 'e> Unpin for CometdClientBuilder<'a, 'b, 'c, 'd, 'e>
impl<'a, 'b, 'c, 'd, 'e> !UnwindSafe for CometdClientBuilder<'a, 'b, 'c, 'd, 'e>
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