mirror of
https://github.com/uuid-rs/uuid.git
synced 2025-10-02 23:34:50 +00:00
Add impl From<Uuid> for String under std feature
This commit is contained in:
parent
97b7f07b3e
commit
22fcf03299
10
src/fmt.rs
10
src/fmt.rs
@ -16,6 +16,9 @@ use crate::{
|
|||||||
Uuid, Variant,
|
Uuid, Variant,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
use crate::std::string::{String, ToString};
|
||||||
|
|
||||||
impl std::fmt::Debug for Uuid {
|
impl std::fmt::Debug for Uuid {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
@ -29,6 +32,13 @@ impl fmt::Display for Uuid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
impl From<Uuid> for String {
|
||||||
|
fn from(uuid: Uuid) -> Self {
|
||||||
|
uuid.to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Display for Variant {
|
impl fmt::Display for Variant {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match *self {
|
match *self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user