id
ModuleContents
Functions
customAn ID given by the caller, as it is.uniqueA new unique ID: 13 hex characters of the current time (`uniqid()`), then `PADDING` random hex characters (20 characters in all).unique_paddedA new unique ID with `padding` random hex characters after the 13 of `uniqid()` (none when `padding` is 0 or less).use utopia_database::helpers::id::custom;Rust
pub fn custom(id: impl Into<String>) -> StringAn ID given by the caller, as it is.
use utopia_database::helpers::id::unique;Rust
pub fn unique() -> Result<String>A new unique ID: 13 hex characters of the current time (uniqid()),
then PADDING random hex characters (20 characters in all).
Rust
use utopia_database::helpers::id;
let id = id::unique().unwrap();
assert_eq!(id.len(), 20);
assert!(id.bytes().all(|c| c.is_ascii_hexdigit()));use utopia_database::helpers::id::unique_padded;Rust
pub fn unique_padded(padding: i64) -> Result<String>A new unique ID with padding random hex characters after the 13 of
uniqid() (none when padding is 0 or less).
Rust
pub const PADDING: i64 = 7The random hex characters unique appends to the time-based part.