pub struct SubscribeOptions {
pub token: Option<PermissionToken>,
}Expand description
Options passed to Mesh::subscribe_channel_with.
Today the only knob is a presented
PermissionToken — the
shape is a struct rather than a bare Option<Token> so future
additions (request-side timeout override, subscribe priority,
etc.) don’t break callers.
§Round-trip shape
// Publisher issues a SUBSCRIBE-scope token for the subscriber.
// The publisher's own `Mesh` is bound to an `Identity`, so the
// token lands in its local cache when `issue_token` is called.
let channel = ChannelName::new("events/trades").unwrap();
let token = publisher_identity.issue_token(
subscriber_entity_id,
TokenScope::SUBSCRIBE,
&channel,
Duration::from_secs(600),
0, // no further delegation
);
// Subscriber (another `Mesh`) calls `subscribe_channel_with`,
// attaching the same token bytes they received from the
// publisher out of band. The publisher verifies the signature,
// checks `subject == subscriber_entity_id`, installs it in its
// cache, then runs `can_subscribe`.
let subscriber: &net_sdk::Mesh = unimplemented!();
subscriber
.subscribe_channel_with(
publisher.node_id(),
&channel,
SubscribeOptions { token: Some(token) },
)
.await?;Fields§
§token: Option<PermissionToken>Token to attach to the subscribe request. The publisher
verifies + installs it before running
ChannelConfig::can_subscribe, so a matching token
satisfies require_token channels end-to-end.
Trait Implementations§
Source§impl Clone for SubscribeOptions
impl Clone for SubscribeOptions
Source§fn clone(&self) -> SubscribeOptions
fn clone(&self) -> SubscribeOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SubscribeOptions
impl Debug for SubscribeOptions
Source§impl Default for SubscribeOptions
impl Default for SubscribeOptions
Source§fn default() -> SubscribeOptions
fn default() -> SubscribeOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SubscribeOptions
impl RefUnwindSafe for SubscribeOptions
impl Send for SubscribeOptions
impl Sync for SubscribeOptions
impl Unpin for SubscribeOptions
impl UnsafeUnpin for SubscribeOptions
impl UnwindSafe for SubscribeOptions
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