mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 12:39:42 +00:00
format code in md
This commit is contained in:
@ -2,13 +2,14 @@
|
||||
|
||||
2. `cargo new --lib hello-package1`
|
||||
|
||||
3. `hello-package` has a binary crate named `hello-package`, `src/main.rs` is the crate root.
|
||||
|
||||
3. `hello-package` has a binary crate named `hello-package`, `src/main.rs` is the crate root.
|
||||
|
||||
`hello-pacakge1` has a library crate named `hello-package1`, `src/lib.rs` is the crate root.
|
||||
|
||||
4. `hello-package1`
|
||||
|
||||
5.
|
||||
|
||||
```shell
|
||||
# FILL in the blanks
|
||||
.
|
||||
@ -20,6 +21,7 @@
|
||||
```
|
||||
|
||||
6.
|
||||
|
||||
```shell
|
||||
# Create a package which contains
|
||||
# 1. three binary crates: `hello-package`, `main1` and `main2`
|
||||
|
@ -1,4 +1,5 @@
|
||||
1.
|
||||
|
||||
```rust
|
||||
// in lib.rs
|
||||
mod front_of_house {
|
||||
@ -21,6 +22,7 @@ mod front_of_house {
|
||||
```
|
||||
|
||||
2.
|
||||
|
||||
```rust
|
||||
// in lib.rs
|
||||
pub mod front_of_house {
|
||||
@ -53,6 +55,7 @@ pub fn eat_at_restaurant() {
|
||||
```
|
||||
|
||||
3.
|
||||
|
||||
```rust
|
||||
mod back_of_house {
|
||||
fn fix_incorrect_order() {
|
||||
@ -75,9 +78,8 @@ mod back_of_house {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
4.
|
||||
|
||||
```rust
|
||||
// in src/lib.rs
|
||||
|
||||
@ -104,7 +106,6 @@ pub fn fix_incorrect_order() {
|
||||
pub fn cook_order() {}
|
||||
```
|
||||
|
||||
|
||||
```rust
|
||||
// in src/front_of_house/mod.rs
|
||||
|
||||
@ -136,8 +137,8 @@ pub fn take_payment() {}
|
||||
fn complain() {}
|
||||
```
|
||||
|
||||
|
||||
5.
|
||||
|
||||
```rust
|
||||
mod front_of_house;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
1.
|
||||
|
||||
```rust
|
||||
use std::fmt::Result;
|
||||
use std::io::Result as IoResult;
|
||||
@ -7,6 +8,7 @@ fn main() {}
|
||||
```
|
||||
|
||||
2.
|
||||
|
||||
```rust
|
||||
use std::collections::*;
|
||||
|
||||
@ -29,8 +31,8 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
3.
|
||||
|
||||
3.
|
||||
```rust
|
||||
// in lib.rs
|
||||
|
||||
|
Reference in New Issue
Block a user