Struct hyperid::Id [−][src]
Structure for keeping data
Implementations
impl Id
[src]
pub fn into_bytes(self) -> Vec<u8>
[src]
Return a bytes representation of id
use hyperid::HyperId; let mut hyperid = HyperId::new(); let id = hyperid.get(); println!("{:?}", id.into_bytes());
pub fn from_bytes(bytes: Vec<u8>) -> Result<Self, ParseIdError>
[src]
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());
pub fn to_url_safe(&self) -> String
[src]
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
pub fn from_url_safe(s: String) -> Result<Id, ParseIdError>
[src]
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
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,