UuidHelper

Struct UuidHelper 

Source
pub struct UuidHelper;
Expand description

Collection of helper functions for converting between Uuid type and its representations in various FF-A containers.

Implementations§

Source§

impl UuidHelper

Source

pub fn from_bytes(value: [u8; 16]) -> Uuid

Converts byte array into Uuid. Example:

  • Input [a1, a2, a3, a4, b1, b2, c1, c2, d1, d2, d3, d4, d5, d6, d7, d8]
  • Output: a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8
Source

pub fn to_bytes(value: Uuid) -> [u8; 16]

Converts Uuid into byte array. Example:

  • Input: a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8
  • Output [a1, a2, a3, a4, b1, b2, c1, c2, d1, d2, d3, d4, d5, d6, d7, d8]
Source

pub fn from_u32_regs(value: [u32; 4]) -> Uuid

Creates Uuid from four 32 bit register values. Example:

  • Input [a4a3a2a1, c2c1b2b1, d4d3d2d1, d8d7d6d5]
  • Output: a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8
Source

pub fn to_u32_regs(value: Uuid) -> [u32; 4]

Converts Uuid into four 32 bit register values. Example:

  • Input: a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8
  • Output [a4a3a2a1, c2c1b2b1, d4d3d2d1, d8d7d6d5]
Source

pub fn from_u64_regs(value: [u64; 2]) -> Uuid

Creates Uuid from a 64 bit register pair. Example:

  • Input [c2c1b2b1a4a3a2a1, d8d7d6d5d4d3d2d1]
  • Output: a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8
Source

pub fn to_u64_regs(value: Uuid) -> [u64; 2]

Converts Uuid into a 64 bit register pair. Example:

  • Input [c2c1b2b1a4a3a2a1, d8d7d6d5d4d3d2d1]
  • Output: a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.