about summary refs log tree commit diff
path: root/src/libstd/sys/windows
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-02-20 18:35:16 +0000
committerbors <bors@rust-lang.org>2016-02-20 18:35:16 +0000
commit788a21edd4fab6c0035d91f1ac9f5896f065e06f (patch)
treefe6ad30da3ba5d35be27ed58ae3612195e65e89b /src/libstd/sys/windows
parent2d14b39204e648a219a17335e712c3fb14666a07 (diff)
parent2338d7419743f876135f723d1823dde16bdb7fdf (diff)
downloadrust-788a21edd4fab6c0035d91f1ac9f5896f065e06f.tar.gz
rust-788a21edd4fab6c0035d91f1ac9f5896f065e06f.zip
Auto merge of #31608 - frewsxcv:osstring-simple-functions, r=alexcrichton
https://github.com/rust-lang/rust/issues/29453
Diffstat (limited to 'src/libstd/sys/windows')
-rw-r--r--src/libstd/sys/windows/os_str.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs
index 91905ae7489..26767a1349e 100644
--- a/src/libstd/sys/windows/os_str.rs
+++ b/src/libstd/sys/windows/os_str.rs
@@ -18,12 +18,25 @@ use string::String;
 use result::Result;
 use option::Option;
 use mem;
+use sys_common::{AsInner, IntoInner};
 
 #[derive(Clone, Hash)]
 pub struct Buf {
     pub inner: Wtf8Buf
 }
 
+impl IntoInner<Wtf8Buf> for Buf {
+    fn into_inner(self) -> Wtf8Buf {
+        self.inner
+    }
+}
+
+impl AsInner<Wtf8> for Buf {
+    fn as_inner(&self) -> &Wtf8 {
+        &self.inner
+    }
+}
+
 impl Debug for Buf {
     fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
         self.as_slice().fmt(formatter)
@@ -41,6 +54,20 @@ impl Debug for Slice {
 }
 
 impl Buf {
+    pub fn with_capacity(capacity: usize) -> Buf {
+        Buf {
+            inner: Wtf8Buf::with_capacity(capacity)
+        }
+    }
+
+    pub fn clear(&mut self) {
+        self.inner.clear()
+    }
+
+    pub fn capacity(&self) -> usize {
+        self.inner.capacity()
+    }
+
     pub fn from_string(s: String) -> Buf {
         Buf { inner: Wtf8Buf::from_string(s) }
     }
@@ -56,6 +83,14 @@ impl Buf {
     pub fn push_slice(&mut self, s: &Slice) {
         self.inner.push_wtf8(&s.inner)
     }
+
+    pub fn reserve(&mut self, additional: usize) {
+        self.inner.reserve(additional)
+    }
+
+    pub fn reserve_exact(&mut self, additional: usize) {
+        self.inner.reserve_exact(additional)
+    }
 }
 
 impl Slice {