pub struct Tokens { /* private fields */ }Expand description
The tokens a connection presents on every session it dials, and the peer’s answer to them.
The first is the connection credential, which each dial carries in SETUP or its URL,
unless the URL already has a ?jwt=. Every other token rides its own AUTH stream on the
sessions of handle, widening the grant. Replacing them presents the new
ones on the live session at once, withdrawing the granted ones they replace only after
every new one has its answer, so the grant never narrows in between.
Reconnect::with_tokens presents them on every dial,
whose Attempt::client builds each session on
handle; aborting the handle ends the policy.
Cheap to clone; every clone shares one set.
Implementations§
Source§impl Tokens
impl Tokens
Sourcepub fn handle(&self) -> Handle
pub fn handle(&self) -> Handle
The handle each session is built on, with Client::with_auth.
Sourcepub fn set(&self, tokens: Vec<Token>)
pub fn set(&self, tokens: Vec<Token>)
Replace every token, reaching the live session at once and every later dial.
Sourcepub fn poll_answered(&self, waiter: &Waiter) -> Poll<Result<()>>
pub fn poll_answered(&self, waiter: &Waiter) -> Poll<Result<()>>
The peer’s first verdict on the tokens the last set newly presented,
or on the initial tokens before any set: Ok once each is granted, in band or as the
connection credential a later dial carried.
A token the set kept, the connection credential included, counts only once the peer refuses it. Nothing is re-checked after the answer: a later revocation, or a new session that refuses a token an earlier one granted, does not change it.
§Errors
The peer’s refusal of a token as Error::Session, Error::Unsupported when the
session cannot carry an in-band token, or the connection’s end, such as a refused dial.
Sourcepub async fn answered(&self) -> Result<()>
pub async fn answered(&self) -> Result<()>
The peer’s first verdict on the tokens the last set newly presented,
or on the initial tokens before any set: Ok once each is granted, in band or as the
connection credential a later dial carried.
A token the set kept, the connection credential included, counts only once the peer refuses it. Nothing is re-checked after the answer: a later revocation, or a new session that refuses a token an earlier one granted, does not change it.
§Errors
The peer’s refusal of a token as Error::Session, Error::Unsupported when the
session cannot carry an in-band token, or the connection’s end, such as a refused dial.
Awaits poll_answered.