Struct guid_create::GUID [−][src]
pub struct GUID { /* fields omitted */ }Expand description
A GUID backed by 16 byte array.
Implementations
Construct a GUID from components.
extern crate guid_create;
let guid = guid_create::GUID::build_from_components(
0x87935CDE,
0x7094,
0x4C2B,
&[ 0xA0, 0xF4, 0xDD, 0x7D, 0x51, 0x2D, 0xD2, 0x61 ]
);
assert_eq!(guid.data1(), 0x87935CDE);
assert_eq!(guid.data2(), 0x7094);
assert_eq!(guid.data3(), 0x4C2B);
assert_eq!(guid.data4(), [ 0xA0, 0xF4, 0xDD, 0x7D, 0x51, 0x2D, 0xD2, 0x61 ]);
assert_eq!(guid.to_string(), "87935CDE-7094-4C2B-A0F4-DD7D512DD261");Construct a GUID from 16 bytes.
extern crate guid_create;
let guid = guid_create::GUID::build_from_slice(&[
0x87, 0x93, 0x5C, 0xDE, 0x70, 0x94, 0x4C, 0x2B, 0xA0, 0xF4, 0xDD, 0x7D, 0x51, 0x2D,
0xD2, 0x61,
]);
assert_eq!(guid.data1(), 0x87935CDE);
assert_eq!(guid.data2(), 0x7094);
assert_eq!(guid.data3(), 0x4C2B);
assert_eq!(
guid.data4(),
[0xA0, 0xF4, 0xDD, 0x7D, 0x51, 0x2D, 0xD2, 0x61]
);
assert_eq!(guid.to_string(), "87935CDE-7094-4C2B-A0F4-DD7D512DD261");Construct a GUID from a string.
Leverages guid-parser for the parsing.
extern crate guid_create;
let guid = guid_create::GUID::parse("87935CDE-7094-4C2B-A0F4-DD7D512DD261").unwrap();
assert_eq!(guid.data1(), 0x87935CDE);
assert_eq!(guid.data2(), 0x7094);
assert_eq!(guid.data3(), 0x4C2B);
assert_eq!(guid.data4(), [ 0xA0, 0xF4, 0xDD, 0x7D, 0x51, 0x2D, 0xD2, 0x61 ]);
assert_eq!(guid.to_string(), "87935CDE-7094-4C2B-A0F4-DD7D512DD261");The first four bytes.
extern crate guid_create;
let guid = guid_create::GUID::build_from_components(
500,
600,
700,
&[ 0xA0, 0xF4, 0xDD, 0x7D, 0x51, 0x2D, 0xD2, 0x61 ]
);
assert_eq!(guid.data1(), 500);Bytes 5 and 6.
extern crate guid_create;
let guid = guid_create::GUID::build_from_components(
500,
600,
700,
&[ 0xA0, 0xF4, 0xDD, 0x7D, 0x51, 0x2D, 0xD2, 0x61 ]
);
assert_eq!(guid.data2(), 600);Bytes 7 and 8.
extern crate guid_create;
let guid = guid_create::GUID::build_from_components(
500,
600,
700,
&[ 0xA0, 0xF4, 0xDD, 0x7D, 0x51, 0x2D, 0xD2, 0x61 ]
);
assert_eq!(guid.data3(), 700);Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for GUID
impl UnwindSafe for GUID
Blanket Implementations
type Err = NoError
type Err = NoError
The error type produced by a failed conversion.
pub fn approx_from(
src: Src
) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
pub fn approx_from(
src: Src
) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
pub fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
pub fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
Mutably borrows from an owned value. Read more
Approximate the subject to a given type with the default scheme.
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
Attempt to convert the subject to a given type.
pub fn vzip(self) -> V
type Err = NoError
type Err = NoError
The error type produced by a failed conversion.
pub fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
pub fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
Convert the given value into an exactly equivalent representation.
type Err = <Dst as ValueFrom<Src>>::Err
type Err = <Dst as ValueFrom<Src>>::Err
The error type produced by a failed conversion.
pub fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
pub fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
Convert the subject into an exactly equivalent representation.
