Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added conversion for Vec<u8> #699

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@

//! Adapters for alternative string formats.

use alloc::vec::Vec;
use crate::{
std::{borrow::Borrow, fmt, ptr, str},
Uuid, Variant,
};

impl From<Uuid> for Vec<u8>{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be conditionally compiled, with a #[cfg(feature = “std”]).

fn from(value: Uuid) -> Self {
value.as_bytes().to_vec()
}
}

impl std::fmt::Debug for Uuid {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ mod macros;
#[doc(hidden)]
#[cfg(feature = "macro-diagnostics")]
pub extern crate uuid_macro_internal;
extern crate alloc;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also need to be conditionally compiled.


#[doc(hidden)]
pub mod __macro_support {
Expand Down