HackMD
  • New!
    New!  Markdown linter lands.
    Write with consistency! Enable markdown linter that hints better markdown styling you can take. Click the lightbulb on the editor status bar 💡
    Got it
      • Create new note
      • Create a note from template
    • New!  Markdown linter lands.
      New!  Markdown linter lands.
      Write with consistency! Enable markdown linter that hints better markdown styling you can take. Click the lightbulb on the editor status bar 💡
      Got it
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Save as template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
      • ODF (Beta)
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
    Menu Sharing Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Gist
    Import
    Dropbox Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML ODF (Beta)
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    Write
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like1 BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    Rust on StackOverflow: Frequent duplicates ========================================== ### Useful links - [Top 100 Most Duplicated Rust Questions](https://data.stackexchange.com/stackoverflow/query/1350611/most-duplicated-rust-questions) (Data Explorer) - [Frequently linked questions](https://stackoverflow.com/questions/tagged/rust?sort=frequent&pageSize=50) (this doesn't have to be "linked as duplicate", but includes every kind of linking) --- ### New questions - [What are the valid path roots in the `use` keyword?](https://stackoverflow.com/questions/54289071/what-are-the-valid-path-roots-in-the-use-keyword) - [Unable to read file contents to string - `Result` does not implement any method in scope named `read_to_string`](https://stackoverflow.com/questions/29214963/unable-to-read-file-contents-to-string-result-does-not-implement-any-method-in) - Regarding `print!` being line buffered: - [print! macro gets executed out of order](https://stackoverflow.com/questions/49607156/print-macro-gets-executed-out-of-order/49607772) - [Why does this read input before printing?](https://stackoverflow.com/questions/34993744/why-does-this-read-input-before-printing) - [How do I print output without a trailing newline in Rust?](https://stackoverflow.com/questions/37531903/how-do-i-print-output-without-a-trailing-newline-in-rust) ### Linked a lot already - [Why can't I store a value and a reference to that value in the same struct?](https://stackoverflow.com/questions/32300132/why-cant-i-store-a-value-and-a-reference-to-that-value-in-the-same-struct) - [Return local String as a slice (`&str`)](https://stackoverflow.com/q/29428227) - [Is there any way to return a reference to a variable created in a function?](https://stackoverflow.com/questions/32682876/is-there-any-way-to-return-a-reference-to-a-variable-created-in-a-function) - ["Expected type parameter" error in the constructor of a generic struct](https://stackoverflow.com/q/32551177) - [Why is it discouraged to accept a reference to a String (&String), Vec (&Vec), or Box (&Box) as a function argument?](https://stackoverflow.com/questions/40006219/why-is-it-discouraged-to-accept-a-reference-to-a-string-string-vec-vec-o) - [Cannot obtain a mutable reference when iterating a recursive structure: cannot borrow as mutable more than once at a time](https://stackoverflow.com/q/37986640) - [Why do `try!()` and `?` not compile when used in a function that doesn't return `Option` or `Result`?](https://stackoverflow.com/q/30555477) - [How to lookup from and insert into a `HashMap` efficiently?](https://stackoverflow.com/q/28512394) - [Unexpected value when reading user input from stdin ](https://stackoverflow.com/q/27773313) (newline trim) - [How can I pass a reference to a stack variable to a thread?](https://stackoverflow.com/q/32750829) - [How can you make a safe static singleton in Rust?](https://stackoverflow.com/q/27221504) - [How do I create a global, mutable singleton?](https://stackoverflow.com/q/27791532) - [Why doesn't Rust support trait object upcasting?](https://stackoverflow.com/q/28632968) - [Why is a trait not implemented for a type that clearly has it implemented?](https://stackoverflow.com/q/44437123) - [How do I create a heterogeneous collection of objects?](https://stackoverflow.com/q/27957103) - [How to get mutable references to two array elements at the same time?](https://stackoverflow.com/q/30073684) - [Rust borrow of a HashMap lasts beyond the scope it's in?](https://stackoverflow.com/q/38023871) - [How can I swap in a new value for a field in a mutable reference to a structure?](https://stackoverflow.com/q/27098694) - [How do I implement a trait I don't own for a type I don't own?](https://stackoverflow.com/q/25413201) - [Why is this match pattern unreachable when using non-literal patterns?](https://stackoverflow.com/q/28225958) - [How do I require a generic type implement an operation like Add, Sub, Mul, or Div in a generic function?](https://stackoverflow.com/q/29184358) - [Mutably borrow one struct field while borrowing another in a closure](https://stackoverflow.com/q/36379242) - [Deriving a trait results in unexpected compiler error, but the manual implementation works](https://stackoverflow.com/q/39415052) - [Cannot borrow as immutable because it is also borrowed as mutable in function arguments](https://stackoverflow.com/q/41187296)

    Import from clipboard

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.
    All
    • All
    • Team
    No template found.

    Create a template

    Delete template

    Do you really want to delete this template?

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in via Google

    New to HackMD? Sign up

    Help

    Documents

    Tutorials
    YAML Metadata
    Slide Example
    Book Example

    Contacts

    Talk to us
    Report an issue
    Send us email

    Cheatsheet

    Example Syntax
    Header # Header
    • Unordered List
    - Unordered List
    1. Ordered List
    1. Ordered List
    • Todo List
    - [ ] Todo List
    Blockquote
    > Blockquote
    Bold font **Bold font**
    Italics font *Italics font*
    Strikethrough ~~Strikethrough~~
    19th 19^th^
    H2O H~2~O
    Inserted text ++Inserted text++
    Marked text ==Marked text==
    Link [link text](https:// "title")
    Image ![image alt](https:// "title")
    Code `Code`
    var i = 0;
    ```javascript
    var i = 0;
    ```
    :smile: :smile:
    Externals {%youtube youtube_id %}
    LaTeX $L^aT_eX$

    This is a alert area.

    :::info
    This is a alert area.
    :::

    Versions

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub

        Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully