-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add doc examples for std::ffi::OsString
fucntions/methods.
#39221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/// use std::ffi::OsString; | ||
/// | ||
/// let os_string = OsString::new(); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub fn new() -> OsString { | ||
OsString { inner: Buf::from_string(String::new()) } | ||
} | ||
|
||
/// Converts to an `OsStr` slice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the url here please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linking these URLs is tangential to my changes in this pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but we tend to forget otherwise. However if you open another PR which does it, I'm perfectly fine with it.
@@ -62,12 +80,32 @@ impl OsString { | |||
/// Converts the `OsString` into a `String` if it contains valid Unicode data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And in here for String
?
/// let os_string = OsString::from("foo"); | ||
/// let string = os_string.into_string(); | ||
/// assert_eq!(string, Ok(String::from("foo"))); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub fn into_string(self) -> Result<String, OsString> { | ||
self.inner.into_string().map_err(|buf| OsString { inner: buf} ) | ||
} | ||
|
||
/// Extends the string with the given `&OsStr` slice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In here as well?
Thanks a lot for this! Can you add the missing urls as well please? |
e1f7732
to
47143e3
Compare
Waiting for travis to confirm before r+. Once it's ok, just r=me. |
@bors r=GuillaumeGomez |
📌 Commit 47143e3 has been approved by |
@bors rollup |
Add doc examples for `std::ffi::OsString` fucntions/methods. None
☀️ Test successful - status-appveyor, status-travis |
No description provided.