typed-oid 0.4.2

Typed Object IDs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use data_encoding::BASE32HEX_NOPAD;
use uuid::Uuid;

use crate::error::{Error, Result};

/// Converts a Base32hex encoded UUID string into a UUID
pub(crate) fn uuid_from_str_b32h(s: &str) -> Result<Uuid> {
    if s.is_empty() {
        return Err(Error::MissingValue);
    }
    Ok(Uuid::from_slice(&BASE32HEX_NOPAD.decode(s.as_bytes())?)?)
}