Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c07ef0c

Browse files
joshtriplettgitbot
authored and
gitbot
committedMar 11, 2025
Implement CloneToUninit for ByteStr
1 parent f082d05 commit c07ef0c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎core/src/clone.rs

+10
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,16 @@ unsafe impl CloneToUninit for crate::ffi::CStr {
311311
}
312312
}
313313

314+
#[unstable(feature = "bstr", issue = "134915")]
315+
unsafe impl CloneToUninit for crate::bstr::ByteStr {
316+
#[inline]
317+
#[cfg_attr(debug_assertions, track_caller)]
318+
unsafe fn clone_to_uninit(&self, dst: *mut u8) {
319+
// SAFETY: ByteStr is a `#[repr(transparent)]` wrapper around `[u8]`
320+
unsafe { self.as_bytes().clone_to_uninit(dst) }
321+
}
322+
}
323+
314324
/// Implementations of `Clone` for primitive types.
315325
///
316326
/// Implementations that cannot be described in Rust

0 commit comments

Comments
 (0)
Failed to load comments.