Skip to content

Commit

Permalink
Add #[inline] for Uuid::from_bytes and Uuid::from_bytes_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
jrose-signal committed Jul 12, 2023
1 parent 0fc3101 commit ff4167a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/builder.rs
Expand Up @@ -412,6 +412,7 @@ impl Uuid {
/// # Ok(())
/// # }
/// ```
#[inline]
pub const fn from_bytes(bytes: Bytes) -> Uuid {
Uuid(bytes)
}
Expand Down Expand Up @@ -480,6 +481,7 @@ impl Uuid {
/// # Ok(())
/// # }
/// ```
#[inline]
pub fn from_bytes_ref(bytes: &Bytes) -> &Uuid {
// SAFETY: `Bytes` and `Uuid` have the same ABI
unsafe { &*(bytes as *const Bytes as *const Uuid) }
Expand Down

0 comments on commit ff4167a

Please sign in to comment.