Skip to content

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

Merged
merged 1 commit into from
Jan 22, 2017

Conversation

frewsxcv
Copy link
Member

No description provided.

@frewsxcv
Copy link
Member Author

r? @GuillaumeGomez

/// 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.
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In here as well?

@GuillaumeGomez
Copy link
Member

Thanks a lot for this! Can you add the missing urls as well please?

@GuillaumeGomez
Copy link
Member

Waiting for travis to confirm before r+. Once it's ok, just r=me.

@frewsxcv
Copy link
Member Author

@bors r=GuillaumeGomez

@bors
Copy link
Collaborator

bors commented Jan 21, 2017

📌 Commit 47143e3 has been approved by GuillaumeGomez

@frewsxcv
Copy link
Member Author

@bors rollup

@bors
Copy link
Collaborator

bors commented Jan 22, 2017

⌛ Testing commit 47143e3 with merge 44858b8...

bors added a commit that referenced this pull request Jan 22, 2017
Add doc examples for `std::ffi::OsString` fucntions/methods.

None
@bors
Copy link
Collaborator

bors commented Jan 22, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: GuillaumeGomez
Pushing 44858b8 to master...

@bors bors merged commit 47143e3 into rust-lang:master Jan 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants