Skip to content

Commit

Permalink
Implement CloneToUninit for ByteStr
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtriplett committed Jan 22, 2025
1 parent 022e7c0 commit 865471f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions library/core/src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,16 @@ unsafe impl CloneToUninit for crate::ffi::CStr {
}
}

#[unstable(feature = "bstr", issue = "134915")]
unsafe impl CloneToUninit for crate::bstr::ByteStr {
#[inline]
#[cfg_attr(debug_assertions, track_caller)]
unsafe fn clone_to_uninit(&self, dst: *mut u8) {
// SAFETY: ByteStr is a `#[repr(transparent)]` wrapper around `[u8]`
unsafe { self.as_bytes().clone_to_uninit(dst) }
}
}

/// Implementations of `Clone` for primitive types.
///
/// Implementations that cannot be described in Rust
Expand Down

0 comments on commit 865471f

Please sign in to comment.