Struct fire_postgres::uid::UniqueId
source · pub struct UniqueId(_);
Expand description
A UniqueId that can be used within a database. Is not cryptographically secure and could be bruteforced.
Contains 10bytes
- 0..5 are seconds since the UNIX_EPOCH
- 5..10 are random
Implementations§
source§impl UniqueId
impl UniqueId
pub fn new() -> Self
sourcepub const fn from_raw(inner: [u8; 10]) -> Self
pub const fn from_raw(inner: [u8; 10]) -> Self
This creates a unique id with it’s raw content making it able to be called in a const context.
pub fn from_slice_unchecked(slice: &[u8]) -> Self
pub fn to_b64(&self) -> String
pub fn parse_from_b64<T>(b64: T) -> Result<Self, DecodeError>where T: AsRef<[u8]>,
pub fn from_bytes(bytes: [u8; 10]) -> Self
pub fn into_bytes(self) -> [u8; 10]
pub fn since_unix_secs(&self) -> u64
pub fn as_slice(&self) -> &[u8] ⓘ
Trait Implementations§
source§impl ColumnType for UniqueId
impl ColumnType for UniqueId
fn column_kind() -> ColumnKind
fn to_data(&self) -> ColumnData<'_>
fn from_data(data: ColumnData<'_>) -> Result<Self, FromDataError>
source§impl<'de> Deserialize<'de> for UniqueId
impl<'de> Deserialize<'de> for UniqueId
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more