pub struct PrefixedUuid<const PFX_1: char, const PFX_2: char, const PFX_3: char> { /* private fields */ }Expand description
A UUID with a 3-character prefix for type-safe identifiers.
This struct wraps a standard UUID and adds a compile-time prefix, ensuring that different types of identifiers (API keys, swarm IDs, etc.) cannot be confused at the type level.
The prefix is specified as three const char generic parameters.
§Type Parameters
PFX_1- First character of the prefixPFX_2- Second character of the prefixPFX_3- Third character of the prefix
§Examples
use objectiveai_sdk::prefixed_uuid::PrefixedUuid;
// Define an API key type with prefix "apk"
type ApiKey = PrefixedUuid<'a', 'p', 'k'>;
// Create a new API key
let key = ApiKey::new();
println!("{}", key); // Outputs: apk<uuid>Implementations§
Source§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> PrefixedUuid<PFX_1, PFX_2, PFX_3>
Trait Implementations§
Source§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Clone for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Clone for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Source§fn clone(&self) -> PrefixedUuid<PFX_1, PFX_2, PFX_3>
fn clone(&self) -> PrefixedUuid<PFX_1, PFX_2, PFX_3>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Debug for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Debug for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Source§impl<'de, const PFX_1: char, const PFX_2: char, const PFX_3: char> Deserialize<'de> for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<'de, const PFX_1: char, const PFX_2: char, const PFX_3: char> Deserialize<'de> for PrefixedUuid<PFX_1, PFX_2, PFX_3>
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
Source§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Display for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Display for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Source§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> From<Uuid> for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> From<Uuid> for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Source§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> FromStr for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> FromStr for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Source§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Hash for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Hash for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Source§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> JsonSchema for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> JsonSchema for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Ord for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Ord for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Source§fn cmp(&self, other: &PrefixedUuid<PFX_1, PFX_2, PFX_3>) -> Ordering
fn cmp(&self, other: &PrefixedUuid<PFX_1, PFX_2, PFX_3>) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> PartialEq for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> PartialEq for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Source§fn eq(&self, other: &PrefixedUuid<PFX_1, PFX_2, PFX_3>) -> bool
fn eq(&self, other: &PrefixedUuid<PFX_1, PFX_2, PFX_3>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> PartialOrd for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> PartialOrd for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Source§impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Serialize for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Serialize for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Copy for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Eq for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> StructuralPartialEq for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Auto Trait Implementations§
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Freeze for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> RefUnwindSafe for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Send for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Sync for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> Unpin for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> UnsafeUnpin for PrefixedUuid<PFX_1, PFX_2, PFX_3>
impl<const PFX_1: char, const PFX_2: char, const PFX_3: char> UnwindSafe for PrefixedUuid<PFX_1, PFX_2, PFX_3>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
Source§impl<T> ToJmespath for Twhere
T: Serialize,
impl<T> ToJmespath for Twhere
T: Serialize,
fn to_jmespath(self) -> Result<Rc<Variable>, JmespathError>
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.