diff options
| author | Lyndon Brown <jnqnfe@gmail.com> | 2018-11-10 07:35:15 +0000 |
|---|---|---|
| committer | Lyndon Brown <jnqnfe@gmail.com> | 2018-11-21 18:30:46 +0000 |
| commit | a1e9c7fc2e4806fe72c84178bf1116f645d18c43 (patch) | |
| tree | a5fab1cf0253e38185f434ac10aae04b5103b823 /src/libstd/ffi | |
| parent | 0591ff7525d3d468244e102c4002b6663db5f5ad (diff) | |
| download | rust-a1e9c7fc2e4806fe72c84178bf1116f645d18c43.tar.gz rust-a1e9c7fc2e4806fe72c84178bf1116f645d18c43.zip | |
OsStr: clarify `len()` method documentation
Diffstat (limited to 'src/libstd/ffi')
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index d5a51c02a47..0edfd122cef 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -590,14 +590,19 @@ impl OsStr { /// Returns the length of this `OsStr`. /// - /// Note that this does **not** return the number of bytes in this string - /// as, for example, OS strings on Windows are encoded as a list of [`u16`] - /// rather than a list of bytes. This number is simply useful for passing to - /// other methods like [`OsString::with_capacity`] to avoid reallocations. + /// Note that this does **not** return the number of bytes in the string in + /// OS string form. /// - /// See `OsStr` introduction for more information about encoding. + /// The length returned is that of the underlying storage used by `OsStr`; + /// As discussed in the [`OsString`] introduction, [`OsString`] and `OsStr` + /// store strings in a form best suited for cheap inter-conversion between + /// native-platform and Rust string forms, which may differ significantly + /// from both of them, including in storage size and encoding. /// - /// [`u16`]: ../primitive.u16.html + /// This number is simply useful for passing to other methods, like + /// [`OsString::with_capacity`] to avoid reallocations. + /// + /// [`OsString`]: struct.OsString.html /// [`OsString::with_capacity`]: struct.OsString.html#method.with_capacity /// /// # Examples |
