diff options
Diffstat (limited to 'src/libstd/sys/windows/os_str.rs')
| -rw-r--r-- | src/libstd/sys/windows/os_str.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs index 3eb4582718b..b8d2f7bc53c 100644 --- a/src/libstd/sys/windows/os_str.rs +++ b/src/libstd/sys/windows/os_str.rs @@ -15,6 +15,8 @@ use borrow::Cow; use fmt; use sys_common::wtf8::{Wtf8, Wtf8Buf}; use mem; +use rc::Rc; +use sync::Arc; use sys_common::{AsInner, IntoInner}; #[derive(Clone, Hash)] @@ -115,6 +117,16 @@ impl Buf { let inner: Box<Wtf8> = unsafe { mem::transmute(boxed) }; Buf { inner: Wtf8Buf::from_box(inner) } } + + #[inline] + pub fn into_arc(&self) -> Arc<Slice> { + self.as_slice().into_arc() + } + + #[inline] + pub fn into_rc(&self) -> Rc<Slice> { + self.as_slice().into_rc() + } } impl Slice { @@ -144,4 +156,16 @@ impl Slice { pub fn empty_box() -> Box<Slice> { unsafe { mem::transmute(Wtf8::empty_box()) } } + + #[inline] + pub fn into_arc(&self) -> Arc<Slice> { + let arc = self.inner.into_arc(); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Slice) } + } + + #[inline] + pub fn into_rc(&self) -> Rc<Slice> { + let rc = self.inner.into_rc(); + unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Slice) } + } } |
