From c1d9bc8b5d41b8972ad92dde8d808247184c8a7a Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Sun, 20 Mar 2022 22:52:42 +0800 Subject: [PATCH] std/OsString: Add detailed comment on args meaning Signed-off-by: Xuanwo --- library/std/src/ffi/os_str.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index 9b5e5d6c0cc4b..bdfe2e625926a 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -188,6 +188,14 @@ impl OsString { /// /// See main `OsString` documentation information about encoding. /// + /// # Notes + /// + /// `capacity` represents the length of the units in the given `OsString`, + /// which is different from the size of "Rust string form" like `String` or + /// `str`. Also, they could be different on different platforms. + /// + /// Refer to [`OsString`] for more details. + /// /// # Examples /// /// ``` @@ -272,6 +280,14 @@ impl OsString { /// greater than or equal to `self.len() + additional`. Does nothing if /// capacity is already sufficient. /// + /// # Notes + /// + /// `additional` represents the length of the units in the given `OsString`, + /// which is different from the size of "Rust string form" like `String` or + /// `str`. Also, they could be different on different platforms. + /// + /// Refer to [`OsString`] for more details. + /// /// # Errors /// /// If the capacity overflows, or the allocator reports a failure, then an error