- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
          add doc for doing Read from &str
          #46088
        
          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
| I'm still running  | 
8998038    to
    bf483fc      
    Compare
  
    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.
some comments
        
          
                src/libstd/io/mod.rs
              
                Outdated
          
        
      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.
I made this hidden since it isn't used in visible code
        
          
                src/libstd/io/mod.rs
              
                Outdated
          
        
      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.
I moved these to the bottom and added &[u8].
95d4c99    to
    44da4a0      
    Compare
  
    | This looks great to me, agree 100%. Thanks so much! @bors: r+ rollup | 
| 📌 Commit 44da4a0 has been approved by  | 
| thanks @steveklabnik, no problem! | 
add doc for doing `Read` from `&str` This information can be found on [stackoverflow](https://stackoverflow.com/questions/32674905/pass-string-to-function-taking-read-trait) but I think it would be beneficial if it was documented in the `Read` trait itself. I had an *extremely* hard time finding this information, and "mocking" a reader with a string is an EXTREMELY common thing (I believe).
| /// # } | ||
| /// ``` | ||
| /// | ||
| /// Read from `&str` because [`&[u8]`] implements [`Read`]: | 
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.
Pulldown doesn't seem to able to parse [`&[u8]`] (@steveklabnik please confirm)
 Documenting std v0.0.0 (file:///home/nodakai/src/rust-HEAD/src/libstd)
WARNING: documentation for this crate may be rendered differently using the new Pulldown renderer.
    See https://github.com/rust-lang/rust/issues/44229 for details.
WARNING: rendering difference in `The `Read` trait allows for reading bytes from a source.`
   --> src/libstd/io/mod.rs:470:0
    /html[0]/body[1]/p[8] Text differs:
        expected: `because`
        found:    `because [`
WARNING: rendering difference in `The `Read` trait allows for reading bytes from a source.`
   --> src/libstd/io/mod.rs:470:0
    /html[0]/body[1]/p[8] Tags differ: expected: `a`, found: `code`
WARNING: rendering difference in `The `Read` trait allows for reading bytes from a source.`
   --> src/libstd/io/mod.rs:470:0
    /html[0]/body[1]/p[8] Text differs:
        expected: `implements`
        found:    `] implements`
WARNING: rendering difference in `The `Read` trait allows for reading bytes from a source.`
   --> src/libstd/io/mod.rs:470:0
    /html[0]/body[1] Unexpected element `p`: found: `<p>[<code>&[u8]</code>]: primitive.slice.html</p>`
This information can be found on stackoverflow but I think it would be beneficial if it was documented in the
Readtrait itself.I had an extremely hard time finding this information, and "mocking" a reader with a string is an EXTREMELY common thing (I believe).