Skip to content

Commit e33695d

Browse files
added the Windows impl
1 parent 6c165d4 commit e33695d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

library/std/src/sys/os_str/wtf8.rs

+5
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ impl Buf {
138138
self.inner.shrink_to(min_capacity)
139139
}
140140

141+
#[inline]
142+
pub fn leak<'a>(self) -> &'a mut Slice {
143+
Slice::from_inner_mut(self.inner.leak())
144+
}
145+
141146
#[inline]
142147
pub fn into_box(self) -> Box<Slice> {
143148
unsafe { mem::transmute(self.inner.into_box()) }

library/std/src/sys_common/wtf8.rs

+5
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ impl Wtf8Buf {
325325
self.bytes.shrink_to(min_capacity)
326326
}
327327

328+
#[inline]
329+
pub fn leak<'a>(self) -> &'a mut Wtf8 {
330+
unsafe { Wtf8::from_mut_bytes_unchecked(self.bytes.leak()) }
331+
}
332+
328333
/// Returns the number of bytes that this string buffer can hold without reallocating.
329334
#[inline]
330335
pub fn capacity(&self) -> usize {

0 commit comments

Comments
 (0)