Struct uuid_b64::UuidB64 [] [src]

pub struct UuidB64(_);

It's a Uuid that displays as Base 64

Methods

impl UuidB64
[src]

[src]

Generate a new v4 Uuid

[src]

Copy the raw UUID out

[src]

Convert this to a new InlineString

InlineStrings are stack-allocated and therefore faster than heap-allocated Strings. How much faster? Somewhat faster:

test uuidb64_to_inline_string                 ... bench:          49 ns/iter (+/- 20)
test uuidb64_to_inline_string_new_id_per_loop ... bench:         146 ns/iter (+/- 23)
test uuidb64_to_string                        ... bench:         151 ns/iter (+/- 28)
test uuidb64_to_string_new_id_per_loop        ... bench:         268 ns/iter (+/- 144)

Honestly this is unlikely to matter for your use case, but since B64 UUIDs have a serialization that does fit within the InlineString limit (where the regular UUID representation does not) it felt like a waste to not do this. Also this is what is used for Serde, so we're zero-allocation for that.

[src]

Write the Base64-encoded UUID into the provided buffer

let known_id = Uuid::parse_str("b0c1ee86-6f46-4f1b-8d8b-7849e75dbcee").unwrap();
let as_b64 = UuidB64::from(known_id);
let mut buf = String::new();
as_b64.to_buf(&mut buf);
assert_eq!(&buf, "sMHuhm9GTxuNi3hJ51287g");

Trait Implementations

impl Copy for UuidB64
[src]

impl Clone for UuidB64
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq for UuidB64
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for UuidB64
[src]

impl Hash for UuidB64
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialOrd for UuidB64
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for UuidB64
[src]

[src]

This method returns an Ordering between self and other. Read more

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl FromStr for UuidB64
[src]

Parse a B64 encoded string into a UuidB64

let parsed_b64: UuidB64 = "sMHuhm9GTxuNi3hJ51287g".parse().unwrap();
assert_eq!(format!("{:?}", parsed_b64), "UuidB64(sMHuhm9GTxuNi3hJ51287g)");

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more

impl<T> From<T> for UuidB64 where
    T: Into<Uuid>, 
[src]

Right now this is just Uuid, but anything Uuid is comfortable with, we are

[src]

Performs the conversion.

impl Debug for UuidB64
[src]

[src]

Same as the display formatter, but includes UuidB64() around it

let known_id = Uuid::parse_str("b0c1ee86-6f46-4f1b-8d8b-7849e75dbcee").unwrap();
let as_b64 = UuidB64::from(known_id);
assert_eq!(format!("{:?}", as_b64), "UuidB64(sMHuhm9GTxuNi3hJ51287g)");

impl Display for UuidB64
[src]

[src]

Write Base64 encoding of this UUID

let known_id = Uuid::parse_str("b0c1ee86-6f46-4f1b-8d8b-7849e75dbcee").unwrap();
let as_b64 = UuidB64::from(known_id);
assert_eq!(format!("{}", as_b64), "sMHuhm9GTxuNi3hJ51287g");

Auto Trait Implementations

impl Send for UuidB64

impl Sync for UuidB64