pub enum TokenAliasType {
Delete,
Register,
UseAlias,
UseValue,
}Expand description
What a Token’s Alias Type says about the fields that follow it.
Drafts 11 through 19 all define the same four code points and describe them as deciding the serialization, not merely the behaviour: “Alias Type - an integer defining both the serialization and the processing behavior of the receiver.” A reader that does not recognise the value therefore cannot know which of the three optional fields are present, which is why an unassigned Alias Type is a formatting error rather than something to skip past.
Variants§
Delete
DELETE (0x0). Carries an Alias and retires it: “This Alias and the Token Value it was previously associated with MUST be retired.”
Register
REGISTER (0x1). Carries an Alias, a Token Type and a Token Value, and binds the Alias to that value for the rest of the session.
UseAlias
USE_ALIAS (0x2). Carries an Alias alone, standing for the Token Type and Token Value registered under it earlier.
UseValue
USE_VALUE (0x3). Carries a Token Type and Token Value and no Alias: “Use the Token Value as provided. The Token Value may be discarded after processing.”
Implementations§
Source§impl TokenAliasType
impl TokenAliasType
Sourcepub const fn from_id(id: u64) -> Option<Self>
pub const fn from_id(id: u64) -> Option<Self>
The Alias Type this code point names, or None if no draft in the range
assigns it.
Sourcepub const fn has_alias(self) -> bool
pub const fn has_alias(self) -> bool
Whether a Token Alias field follows the Alias Type.
Three of the four carry one. USE_VALUE is the exception — “There is no Alias and there is a Type and Value” — and it is the only form a sender can use before it has registered anything.
Sourcepub const fn has_type_and_value(self) -> bool
pub const fn has_type_and_value(self) -> bool
Whether a Token Type and a Token Value follow.
The two travel together in every form: REGISTER and USE_VALUE carry both, DELETE and USE_ALIAS carry neither, and no form carries one without the other.
Trait Implementations§
Source§impl Clone for TokenAliasType
impl Clone for TokenAliasType
Source§fn clone(&self) -> TokenAliasType
fn clone(&self) -> TokenAliasType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more