Add impl From<Uuid> for String under std feature

This commit is contained in:
David Kwong 2023-08-05 02:15:16 +00:00
parent 97b7f07b3e
commit 22fcf03299

View File

@ -16,6 +16,9 @@ use crate::{
Uuid, Variant,
};
#[cfg(feature = "std")]
use crate::std::string::{String, ToString};
impl std::fmt::Debug for Uuid {
#[inline]
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 {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {