Skip to content

Commit

Permalink
Add Rust operator link and comments (#2998)
Browse files Browse the repository at this point in the history
* Add Rust operator link and add comments

Added comments in front of `...` to make it easier to use the Microsoft Doc's great **Copy** feature. Added links to relevant docs about Rust's `?` operator.

* Add Rust operator link and add comments 

Added comments in front of `...` to make it easier to use the Microsoft Doc's great **Copy** feature. Added links to relevant docs about Rust's `?` operator.

* Add note about how to run project with `cargo`

VSCode is not my primary editor and I did not have **Run** set up for Rust. I added a note mentioning how to run the project using the `cargo` CLI from the command prompt as well.

* Edits

Co-authored-by: Steven White <stwhi@microsoft.com>
  • Loading branch information
camerondurham and stevewhims committed Mar 5, 2021
1 parent f08af6f commit 1c51e2b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hub/dev-environment/rust/rss-reader-rust-for-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Now let's try out Rust for Windows by writing a simple app that downloads the ti

Notice that we're using the **windows::Result** as the return type of the **main** function. This will make things easier, as it's common to deal with errors from operating system (OS) APIs.

You can see the question-mark operator at the end of the line of code that creates a **Uri**. To save on typing, we do that to make use of Rust's error-propagation and short-circuiting logic. That means we don't have to do a bunch of manual error handling for this simple example.
You can see the question-mark operator at the end of the line of code that creates a **Uri**. To save on typing, we do that to make use of Rust's error-propagation and short-circuiting logic. That means we don't have to do a bunch of manual error handling for this simple example. For more info about this feature of Rust, see [The ? operator for easier error handling](https://doc.rust-lang.org/edition-guide/rust-2018/error-handling-and-panics/the-question-mark-operator-for-easier-error-handling.html).

11. To download this RSS feed, we'll create a new **SyndicationClient** object.

Expand Down Expand Up @@ -180,7 +180,7 @@ Because [**RetrieveFeedAsync**](/uwp/api/windows.web.syndication.syndicationclie
}
```

14. Now let's confirm that we can build and run by clicking **Run** > **Run Without Debugging** (or pressing **Ctrl+F5**). There are also **Debug** and **Run** commands embedded inside the text editor.
14. Now let's confirm that we can build and run by clicking **Run** > **Run Without Debugging** (or pressing **Ctrl+F5**). There are also **Debug** and **Run** commands embedded inside the text editor. Alternatively, you can submit the command `cargo run` from the command prompt (`cd` into the `rss_reader` folder first), which will build and then run.

![The Debug and Run commands embedded inside the text editor](../../images/rust-rss-reader-2.png)

Expand All @@ -194,3 +194,4 @@ That's as simple as it is to program Rust for Windows. Under the hood, however,

* [Rust for Windows, and the windows crate](rust-for-windows.md)
* [ECMA-335](https://www.ecma-international.org/publications-and-standards/standards/ecma-335/)
* [The ? operator for easier error handling](https://doc.rust-lang.org/edition-guide/rust-2018/error-handling-and-panics/the-question-mark-operator-for-easier-error-handling.html)

0 comments on commit 1c51e2b

Please sign in to comment.