pub struct CallOptions { /* private fields */ }
Expand description
General options that clients might want to specify when sending a uProtocol message.
Implementations§
Source§impl CallOptions
impl CallOptions
Sourcepub fn for_rpc_request(
ttl: u32,
message_id: Option<UUID>,
token: Option<String>,
priority: Option<UPriority>,
) -> Self
pub fn for_rpc_request( ttl: u32, message_id: Option<UUID>, token: Option<String>, priority: Option<UPriority>, ) -> Self
Creates new call options for an RPC Request.
§Arguments
ttl
- The message’s time-to-live in milliseconds.message_id
- The identifier to use for the message orNone
to use a generated identifier.token
- The token to use for authenticating to infrastructure and service endpoints.priority
- The message’s priority orNone
to use the default priority for RPC Requests.
§Returns
Options suitable for invoking an RPC method.
§Examples
use up_rust::{UPriority, UUID, communication::CallOptions};
let uuid = UUID::new();
let options = CallOptions::for_rpc_request(15_000, Some(uuid.clone()), Some("token".to_string()), Some(UPriority::UPRIORITY_CS6));
assert_eq!(options.ttl(), 15_000);
assert_eq!(options.message_id(), Some(uuid));
assert_eq!(options.token(), Some("token".to_string()));
assert_eq!(options.priority(), Some(UPriority::UPRIORITY_CS6));
Sourcepub fn for_notification(
ttl: Option<u32>,
message_id: Option<UUID>,
priority: Option<UPriority>,
) -> Self
pub fn for_notification( ttl: Option<u32>, message_id: Option<UUID>, priority: Option<UPriority>, ) -> Self
Creates new call options for a Notification message.
§Arguments
ttl
- The message’s time-to-live in milliseconds.message_id
- The identifier to use for the message orNone
to use a generated identifier.priority
- The message’s priority orNone
to use the default priority for Notifications.
§Returns
Options suitable for sending a Notification.
§Examples
use up_rust::{UPriority, UUID, communication::CallOptions};
let uuid = UUID::new();
let options = CallOptions::for_notification(Some(15_000), Some(uuid.clone()), Some(UPriority::UPRIORITY_CS2));
assert_eq!(options.ttl(), 15_000);
assert_eq!(options.message_id(), Some(uuid));
assert_eq!(options.priority(), Some(UPriority::UPRIORITY_CS2));
Sourcepub fn for_publish(
ttl: Option<u32>,
message_id: Option<UUID>,
priority: Option<UPriority>,
) -> Self
pub fn for_publish( ttl: Option<u32>, message_id: Option<UUID>, priority: Option<UPriority>, ) -> Self
Creates new call options for a Publish message.
§Arguments
ttl
- The message’s time-to-live in milliseconds orNone
if the message should not expire at all.message_id
- The identifier to use for the message orNone
to use a generated identifier.priority
- The message’s priority orNone
to use the default priority for Publish messages.
§Returns
Options suitable for sending a Publish message.
§Examples
use up_rust::{UPriority, UUID, communication::CallOptions};
let uuid = UUID::new();
let options = CallOptions::for_publish(Some(15_000), Some(uuid.clone()), Some(UPriority::UPRIORITY_CS2));
assert_eq!(options.ttl(), 15_000);
assert_eq!(options.message_id(), Some(uuid));
assert_eq!(options.priority(), Some(UPriority::UPRIORITY_CS2));
Sourcepub fn message_id(&self) -> Option<UUID>
pub fn message_id(&self) -> Option<UUID>
Gets the identifier to use for the message.
Trait Implementations§
Source§impl Clone for CallOptions
impl Clone for CallOptions
Source§fn clone(&self) -> CallOptions
fn clone(&self) -> CallOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for CallOptions
impl Debug for CallOptions
Source§impl PartialEq for CallOptions
impl PartialEq for CallOptions
impl StructuralPartialEq for CallOptions
Auto Trait Implementations§
impl !Freeze for CallOptions
impl RefUnwindSafe for CallOptions
impl Send for CallOptions
impl Sync for CallOptions
impl Unpin for CallOptions
impl UnwindSafe for CallOptions
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