Struct hyperid::Id[][src]

pub struct Id { /* fields omitted */ }
Expand description

Structure for keeping data

Implementations

Return a bytes representation of id

use hyperid::HyperId;
let mut hyperid = HyperId::new();
let id = hyperid.get();
println!("{:?}", id.into_bytes());

Build Id instance from bytes

use hyperid::{HyperId, Id};
let bytes = vec![0; 17];
let id = Id::from_bytes(bytes).unwrap();
assert_eq!(vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], id.into_bytes());
This is supported on crate feature url_safe only.

Return an url safe string

use hyperid::HyperId;
let mut hyperid = HyperId::new();
let id = hyperid.get();
println!("{}", id.to_url_safe()); // 3ZAYYJilG7vHTqiUuaQdFg.0
This is supported on crate feature url_safe only.

Return an url safe string

use hyperid::{HyperId, Id};
let mut hyperid = HyperId::new();
let id1 = hyperid.get();
let s = id1.to_url_safe();
let id2 = Id::from_url_safe(s).unwrap();
assert_eq!(id1, id2);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.