pub enum Identity {
NodeId(Bytes),
PeerId(Bytes),
Uuid(Uuid),
Custom {
kind: String,
id: Bytes,
},
}Expand description
A segment representing a unique identity.
This can be used to include cryptographic identities (like NodeId, PeerId), UUIDs, or custom identity types in an address stack.
Binary identity data is encoded as base32 in string form.
Variants§
NodeId(Bytes)
A node ID, such as a public key (e.g. Ed25519)
PeerId(Bytes)
A peer ID, as used in many P2P protocols
Uuid(Uuid)
A UUID (supports hyphenless base16 string output)
Custom
A custom identity with an explicit kind and ID bytes
Implementations§
Source§impl Identity
impl Identity
Sourcepub fn id_bytes(&self) -> &[u8] ⓘ
pub fn id_bytes(&self) -> &[u8] ⓘ
Returns the underlying identity bytes for this variant.
For Uuid, this returns the canonical 16-byte representation.
Sourcepub fn to_base64url(&self) -> String
pub fn to_base64url(&self) -> String
Encodes the identity bytes as URL-safe base64 without padding.
pub fn from_base32_node(encoded: &str) -> Result<Self, StackAddrError>
pub fn from_base32_peer(encoded: &str) -> Result<Self, StackAddrError>
pub fn from_base32_custom( kind: impl Into<String>, encoded: &str, ) -> Result<Self, StackAddrError>
Trait Implementations§
Source§impl Ord for Identity
impl Ord for Identity
Source§impl PartialOrd for Identity
impl PartialOrd for Identity
impl Eq for Identity
impl StructuralPartialEq for Identity
Auto Trait Implementations§
impl !Freeze for Identity
impl RefUnwindSafe for Identity
impl Send for Identity
impl Sync for Identity
impl Unpin for Identity
impl UnwindSafe for Identity
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