diff options
| author | bors <bors@rust-lang.org> | 2016-08-20 07:09:53 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-20 07:09:53 -0700 |
| commit | 490189634b656dcca9e41e6b52093569c03bd4df (patch) | |
| tree | e437ade751764c2f56a3c9c3be904b815ad27031 /src/libstd/ffi | |
| parent | 99867ee88380062827b63ce547603eea5fd3136c (diff) | |
| parent | 9072861c2044b85c3bb8503487d5772297053cf8 (diff) | |
| download | rust-490189634b656dcca9e41e6b52093569c03bd4df.tar.gz rust-490189634b656dcca9e41e6b52093569c03bd4df.zip | |
Auto merge of #35857 - jonathandturner:rollup, r=jonathandturner
Rollup of 19 pull requests - Successful merges: #35234, #35701, #35709, #35710, #35775, #35778, #35780, #35781, #35794, #35800, #35804, #35806, #35811, #35812, #35818, #35827, #35830, #35831, #35839 - Failed merges: #35759
Diffstat (limited to 'src/libstd/ffi')
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 0d29e62485a..3d23a9a2383 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -251,6 +251,14 @@ impl Hash for OsString { impl OsStr { /// Coerces into an `OsStr` slice. + /// + /// # Examples + /// + /// ``` + /// use std::ffi::OsStr; + /// + /// let os_str = OsStr::new("foo"); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &OsStr { s.as_ref() @@ -283,6 +291,18 @@ impl OsStr { } /// Checks whether the `OsStr` is empty. + /// + /// # Examples + /// + /// ``` + /// use std::ffi::OsStr; + /// + /// let os_str = OsStr::new(""); + /// assert!(os_str.is_empty()); + /// + /// let os_str = OsStr::new("foo"); + /// assert!(!os_str.is_empty()); + /// ``` #[stable(feature = "osstring_simple_functions", since = "1.9.0")] pub fn is_empty(&self) -> bool { self.inner.inner.is_empty() @@ -296,6 +316,18 @@ impl OsStr { /// other methods like `OsString::with_capacity` to avoid reallocations. /// /// See `OsStr` introduction for more information about encoding. + /// + /// # Examples + /// + /// ``` + /// use std::ffi::OsStr; + /// + /// let os_str = OsStr::new(""); + /// assert_eq!(os_str.len(), 0); + /// + /// let os_str = OsStr::new("foo"); + /// assert_eq!(os_str.len(), 3); + /// ``` #[stable(feature = "osstring_simple_functions", since = "1.9.0")] pub fn len(&self) -> usize { self.inner.inner.len() |
