mirror of
https://github.com/uuid-rs/uuid.git
synced 2025-10-02 15:24:57 +00:00
add const uuid::from_uuid_bytes
This commit is contained in:
parent
baa0389dc8
commit
096fc74faa
1
.cargo/.gitignore
vendored
Normal file
1
.cargo/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/config
|
@ -33,6 +33,7 @@ serde_test = "1.0.19"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
nightly = []
|
||||
std = []
|
||||
use_std = ["std"] # Compatibility shim for 0.5 and earlier
|
||||
v1 = []
|
||||
|
@ -111,6 +111,7 @@
|
||||
)]
|
||||
#![deny(warnings)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![feature(const_fn)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate cfg_if;
|
||||
@ -714,10 +715,16 @@ impl Uuid {
|
||||
///
|
||||
/// let uuid = Uuid::from_uuid_bytes(bytes);
|
||||
/// ```
|
||||
#[cfg(not(feature = "nightly"))]
|
||||
pub fn from_uuid_bytes(b: UuidBytes) -> Uuid {
|
||||
Uuid { bytes: b }
|
||||
}
|
||||
|
||||
#[cfg(feature = "nightly")]
|
||||
pub const fn from_uuid_bytes(b: UuidBytes) -> Uuid {
|
||||
Uuid { bytes: b }
|
||||
}
|
||||
|
||||
/// Creates a v4 Uuid from random bytes (e.g. bytes supplied from `Rand` crate)
|
||||
///
|
||||
/// # Examples
|
||||
|
Loading…
x
Reference in New Issue
Block a user