diff --git a/en/.gitignore b/.gitignore similarity index 100% rename from en/.gitignore rename to .gitignore diff --git a/en/assets/CNAME b/assets/CNAME similarity index 100% rename from en/assets/CNAME rename to assets/CNAME diff --git a/en/book.toml b/book.toml similarity index 93% rename from en/book.toml rename to book.toml index f0e492b..5d2954b 100644 --- a/en/book.toml +++ b/book.toml @@ -12,7 +12,6 @@ editor = "ace" enable = true [output.html] -additional-js = ["assets/lang.js"] git-repository-url = "https://github.com/sunface/rust-exercise" edit-url-template = "https://github.com/sunface/rust-exercise/edit/master/{path}" diff --git a/en/deploy b/deploy similarity index 87% rename from en/deploy rename to deploy index b45e213..c1c7896 100755 --- a/en/deploy +++ b/deploy @@ -15,7 +15,7 @@ git config user.email "cto@188.com" git add . git commit -m 'deploy' git branch -M gh-pages -git remote add origin https://github.com/course-rs/rust-exercise +git remote add origin https://github.com/sunface/rust-exercise ## push to github pages git push -u -f origin gh-pages \ No newline at end of file diff --git a/en/src/SUMMARY.md b/src/SUMMARY.md similarity index 100% rename from en/src/SUMMARY.md rename to src/SUMMARY.md diff --git a/en/src/async/async-await.md b/src/async/async-await.md similarity index 100% rename from en/src/async/async-await.md rename to src/async/async-await.md diff --git a/en/src/async/future.md b/src/async/future.md similarity index 100% rename from en/src/async/future.md rename to src/async/future.md diff --git a/en/src/async/intro.md b/src/async/intro.md similarity index 100% rename from en/src/async/intro.md rename to src/async/intro.md diff --git a/en/src/async/pin-unpin.md b/src/async/pin-unpin.md similarity index 100% rename from en/src/async/pin-unpin.md rename to src/async/pin-unpin.md diff --git a/en/src/async/stream.md b/src/async/stream.md similarity index 100% rename from en/src/async/stream.md rename to src/async/stream.md diff --git a/en/src/basic-types/char-bool-unit.md b/src/basic-types/char-bool-unit.md similarity index 100% rename from en/src/basic-types/char-bool-unit.md rename to src/basic-types/char-bool-unit.md diff --git a/en/src/basic-types/functions.md b/src/basic-types/functions.md similarity index 100% rename from en/src/basic-types/functions.md rename to src/basic-types/functions.md diff --git a/en/src/basic-types/intro.md b/src/basic-types/intro.md similarity index 100% rename from en/src/basic-types/intro.md rename to src/basic-types/intro.md diff --git a/en/src/basic-types/numbers.md b/src/basic-types/numbers.md similarity index 100% rename from en/src/basic-types/numbers.md rename to src/basic-types/numbers.md diff --git a/en/src/basic-types/statements-expressions.md b/src/basic-types/statements-expressions.md similarity index 100% rename from en/src/basic-types/statements-expressions.md rename to src/basic-types/statements-expressions.md diff --git a/en/src/circle-refer b/src/circle-refer similarity index 100% rename from en/src/circle-refer rename to src/circle-refer diff --git a/en/src/circle-reference/intro.md b/src/circle-reference/intro.md similarity index 100% rename from en/src/circle-reference/intro.md rename to src/circle-reference/intro.md diff --git a/en/src/collections/hashmap.md b/src/collections/hashmap.md similarity index 100% rename from en/src/collections/hashmap.md rename to src/collections/hashmap.md diff --git a/en/src/collections/intro.md b/src/collections/intro.md similarity index 100% rename from en/src/collections/intro.md rename to src/collections/intro.md diff --git a/en/src/collections/vector.md b/src/collections/vector.md similarity index 100% rename from en/src/collections/vector.md rename to src/collections/vector.md diff --git a/en/src/comments-docs.md b/src/comments-docs.md similarity index 100% rename from en/src/comments-docs.md rename to src/comments-docs.md diff --git a/en/src/compound-types/array.md b/src/compound-types/array.md similarity index 100% rename from en/src/compound-types/array.md rename to src/compound-types/array.md diff --git a/en/src/compound-types/enum.md b/src/compound-types/enum.md similarity index 100% rename from en/src/compound-types/enum.md rename to src/compound-types/enum.md diff --git a/en/src/compound-types/intro.md b/src/compound-types/intro.md similarity index 100% rename from en/src/compound-types/intro.md rename to src/compound-types/intro.md diff --git a/en/src/compound-types/string-slice.md b/src/compound-types/string-slice.md similarity index 100% rename from en/src/compound-types/string-slice.md rename to src/compound-types/string-slice.md diff --git a/en/src/compound-types/struct.md b/src/compound-types/struct.md similarity index 100% rename from en/src/compound-types/struct.md rename to src/compound-types/struct.md diff --git a/en/src/compound-types/tuple.md b/src/compound-types/tuple.md similarity index 100% rename from en/src/compound-types/tuple.md rename to src/compound-types/tuple.md diff --git a/en/src/crate b/src/crate similarity index 100% rename from en/src/crate rename to src/crate diff --git a/en/src/crate-module/crate.md b/src/crate-module/crate.md similarity index 100% rename from en/src/crate-module/crate.md rename to src/crate-module/crate.md diff --git a/en/src/crate-module/intro.md b/src/crate-module/intro.md similarity index 100% rename from en/src/crate-module/intro.md rename to src/crate-module/intro.md diff --git a/en/src/crate-module/module.md b/src/crate-module/module.md similarity index 100% rename from en/src/crate-module/module.md rename to src/crate-module/module.md diff --git a/en/src/crate-module/use-pub.md b/src/crate-module/use-pub.md similarity index 100% rename from en/src/crate-module/use-pub.md rename to src/crate-module/use-pub.md diff --git a/en/src/errors.md b/src/errors.md similarity index 100% rename from en/src/errors.md rename to src/errors.md diff --git a/en/src/flow-control.md b/src/flow-control.md similarity index 100% rename from en/src/flow-control.md rename to src/flow-control.md diff --git a/en/src/formatted-output.md b/src/formatted-output.md similarity index 100% rename from en/src/formatted-output.md rename to src/formatted-output.md diff --git a/en/src/functional-programing/cloure.md b/src/functional-programing/cloure.md similarity index 100% rename from en/src/functional-programing/cloure.md rename to src/functional-programing/cloure.md diff --git a/en/src/functional-programing/intro.md b/src/functional-programing/intro.md similarity index 100% rename from en/src/functional-programing/intro.md rename to src/functional-programing/intro.md diff --git a/en/src/functional-programing/iterator.md b/src/functional-programing/iterator.md similarity index 100% rename from en/src/functional-programing/iterator.md rename to src/functional-programing/iterator.md diff --git a/en/src/functional-programming/closure.md b/src/functional-programming/closure.md similarity index 100% rename from en/src/functional-programming/closure.md rename to src/functional-programming/closure.md diff --git a/en/src/functional-programming/intro.md b/src/functional-programming/intro.md similarity index 100% rename from en/src/functional-programming/intro.md rename to src/functional-programming/intro.md diff --git a/en/src/generics-traits/advance-traits.md b/src/generics-traits/advance-traits.md similarity index 100% rename from en/src/generics-traits/advance-traits.md rename to src/generics-traits/advance-traits.md diff --git a/en/src/generics-traits/generics.md b/src/generics-traits/generics.md similarity index 100% rename from en/src/generics-traits/generics.md rename to src/generics-traits/generics.md diff --git a/en/src/generics-traits/intro.md b/src/generics-traits/intro.md similarity index 100% rename from en/src/generics-traits/intro.md rename to src/generics-traits/intro.md diff --git a/en/src/generics-traits/trait-object.md b/src/generics-traits/trait-object.md similarity index 100% rename from en/src/generics-traits/trait-object.md rename to src/generics-traits/trait-object.md diff --git a/en/src/generics-traits/traits.md b/src/generics-traits/traits.md similarity index 100% rename from en/src/generics-traits/traits.md rename to src/generics-traits/traits.md diff --git a/en/src/global-variables.md b/src/global-variables.md similarity index 100% rename from en/src/global-variables.md rename to src/global-variables.md diff --git a/en/src/lifetime/advance.md b/src/lifetime/advance.md similarity index 100% rename from en/src/lifetime/advance.md rename to src/lifetime/advance.md diff --git a/en/src/lifetime/basic.md b/src/lifetime/basic.md similarity index 100% rename from en/src/lifetime/basic.md rename to src/lifetime/basic.md diff --git a/en/src/lifetime/intro.md b/src/lifetime/intro.md similarity index 100% rename from en/src/lifetime/intro.md rename to src/lifetime/intro.md diff --git a/en/src/lifetime/static.md b/src/lifetime/static.md similarity index 100% rename from en/src/lifetime/static.md rename to src/lifetime/static.md diff --git a/en/src/macro.md b/src/macro.md similarity index 100% rename from en/src/macro.md rename to src/macro.md diff --git a/en/src/method.md b/src/method.md similarity index 100% rename from en/src/method.md rename to src/method.md diff --git a/en/src/newtype-sized.md b/src/newtype-sized.md similarity index 100% rename from en/src/newtype-sized.md rename to src/newtype-sized.md diff --git a/en/src/ownership/borrowing.md b/src/ownership/borrowing.md similarity index 100% rename from en/src/ownership/borrowing.md rename to src/ownership/borrowing.md diff --git a/en/src/ownership/intro.md b/src/ownership/intro.md similarity index 100% rename from en/src/ownership/intro.md rename to src/ownership/intro.md diff --git a/en/src/ownership/ownership.md b/src/ownership/ownership.md similarity index 100% rename from en/src/ownership/ownership.md rename to src/ownership/ownership.md diff --git a/en/src/pattern-match/intro.md b/src/pattern-match/intro.md similarity index 100% rename from en/src/pattern-match/intro.md rename to src/pattern-match/intro.md diff --git a/en/src/pattern-match/match-iflet.md b/src/pattern-match/match-iflet.md similarity index 100% rename from en/src/pattern-match/match-iflet.md rename to src/pattern-match/match-iflet.md diff --git a/en/src/pattern-match/option.md b/src/pattern-match/option.md similarity index 100% rename from en/src/pattern-match/option.md rename to src/pattern-match/option.md diff --git a/en/src/pattern-match/patterns.md b/src/pattern-match/patterns.md similarity index 100% rename from en/src/pattern-match/patterns.md rename to src/pattern-match/patterns.md diff --git a/en/src/resu b/src/resu similarity index 100% rename from en/src/resu rename to src/resu diff --git a/en/src/result-panic/intro.md b/src/result-panic/intro.md similarity index 100% rename from en/src/result-panic/intro.md rename to src/result-panic/intro.md diff --git a/en/src/result-panic/panic.md b/src/result-panic/panic.md similarity index 100% rename from en/src/result-panic/panic.md rename to src/result-panic/panic.md diff --git a/en/src/result-panic/result.md b/src/result-panic/result.md similarity index 100% rename from en/src/result-panic/result.md rename to src/result-panic/result.md diff --git a/en/src/self-referential.md b/src/self-referential.md similarity index 100% rename from en/src/self-referential.md rename to src/self-referential.md diff --git a/en/src/smart-pointers/box.md b/src/smart-pointers/box.md similarity index 100% rename from en/src/smart-pointers/box.md rename to src/smart-pointers/box.md diff --git a/en/src/smart-pointers/cell-refcell.md b/src/smart-pointers/cell-refcell.md similarity index 100% rename from en/src/smart-pointers/cell-refcell.md rename to src/smart-pointers/cell-refcell.md diff --git a/en/src/smart-pointers/deref.md b/src/smart-pointers/deref.md similarity index 100% rename from en/src/smart-pointers/deref.md rename to src/smart-pointers/deref.md diff --git a/en/src/smart-pointers/drop.md b/src/smart-pointers/drop.md similarity index 100% rename from en/src/smart-pointers/drop.md rename to src/smart-pointers/drop.md diff --git a/en/src/smart-pointers/intro.md b/src/smart-pointers/intro.md similarity index 100% rename from en/src/smart-pointers/intro.md rename to src/smart-pointers/intro.md diff --git a/en/src/smart-pointers/rc-arc.md b/src/smart-pointers/rc-arc.md similarity index 100% rename from en/src/smart-pointers/rc-arc.md rename to src/smart-pointers/rc-arc.md diff --git a/en/src/tests/assertions.md b/src/tests/assertions.md similarity index 100% rename from en/src/tests/assertions.md rename to src/tests/assertions.md diff --git a/en/src/tests/benchmark.md b/src/tests/benchmark.md similarity index 100% rename from en/src/tests/benchmark.md rename to src/tests/benchmark.md diff --git a/en/src/tests/intro.md b/src/tests/intro.md similarity index 100% rename from en/src/tests/intro.md rename to src/tests/intro.md diff --git a/en/src/tests/unit-integration.md b/src/tests/unit-integration.md similarity index 100% rename from en/src/tests/unit-integration.md rename to src/tests/unit-integration.md diff --git a/en/src/tests/write-tests.md b/src/tests/write-tests.md similarity index 100% rename from en/src/tests/write-tests.md rename to src/tests/write-tests.md diff --git a/en/src/threads/atomic.md b/src/threads/atomic.md similarity index 100% rename from en/src/threads/atomic.md rename to src/threads/atomic.md diff --git a/en/src/threads/basic-using.md b/src/threads/basic-using.md similarity index 100% rename from en/src/threads/basic-using.md rename to src/threads/basic-using.md diff --git a/en/src/threads/intro.md b/src/threads/intro.md similarity index 100% rename from en/src/threads/intro.md rename to src/threads/intro.md diff --git a/en/src/threads/message-passing.md b/src/threads/message-passing.md similarity index 100% rename from en/src/threads/message-passing.md rename to src/threads/message-passing.md diff --git a/en/src/threads/send-sync.md b/src/threads/send-sync.md similarity index 100% rename from en/src/threads/send-sync.md rename to src/threads/send-sync.md diff --git a/en/src/threads/sync.md b/src/threads/sync.md similarity index 100% rename from en/src/threads/sync.md rename to src/threads/sync.md diff --git a/en/src/type-conversion.md b/src/type-conversion.md similarity index 100% rename from en/src/type-conversion.md rename to src/type-conversion.md diff --git a/en/src/unsafe.md b/src/unsafe.md similarity index 100% rename from en/src/unsafe.md rename to src/unsafe.md diff --git a/en/src/variables.md b/src/variables.md similarity index 100% rename from en/src/variables.md rename to src/variables.md diff --git a/en/src/weak.md b/src/weak.md similarity index 100% rename from en/src/weak.md rename to src/weak.md diff --git a/en/src/why-exercise.md b/src/why-exercise.md similarity index 100% rename from en/src/why-exercise.md rename to src/why-exercise.md diff --git a/zh/.gitignore b/zh/.gitignore deleted file mode 100644 index 7585238..0000000 --- a/zh/.gitignore +++ /dev/null @@ -1 +0,0 @@ -book diff --git a/zh/assets/CNAME b/zh/assets/CNAME deleted file mode 100644 index d893176..0000000 --- a/zh/assets/CNAME +++ /dev/null @@ -1 +0,0 @@ -zh.exercise.rs \ No newline at end of file diff --git a/zh/book.toml b/zh/book.toml deleted file mode 100644 index f0e492b..0000000 --- a/zh/book.toml +++ /dev/null @@ -1,20 +0,0 @@ -[book] -title = "Rust Exercise" -description = "A set of exercises and examples to pratice various aspects of Rust, also for the rust course (book) at https://course.rs" -authors = ["sunface, https://im.dev"] -language = "en" - -[output.html.playpen] -editable = true -editor = "ace" - -[output.html.fold] -enable = true - -[output.html] -additional-js = ["assets/lang.js"] -git-repository-url = "https://github.com/sunface/rust-exercise" -edit-url-template = "https://github.com/sunface/rust-exercise/edit/master/{path}" - -[rust] -edition = "2021" \ No newline at end of file diff --git a/zh/deploy b/zh/deploy deleted file mode 100755 index b45e213..0000000 --- a/zh/deploy +++ /dev/null @@ -1,21 +0,0 @@ -## this script deploys the static website of course.rs to github pages - -## build static website for book -mdbook build -## copy CNAME info to book dir -cp ./assets/CNAME ./book/ -cp ./assets/*.html ./book/ -cp ./assets/sitemap.xml ./book/ - -## init git repo -cd book -git init -git config user.name "sunface" -git config user.email "cto@188.com" -git add . -git commit -m 'deploy' -git branch -M gh-pages -git remote add origin https://github.com/course-rs/rust-exercise - -## push to github pages -git push -u -f origin gh-pages \ No newline at end of file diff --git a/zh/src/SUMMARY.md b/zh/src/SUMMARY.md deleted file mode 100644 index 1bd5e42..0000000 --- a/zh/src/SUMMARY.md +++ /dev/null @@ -1,79 +0,0 @@ -# Summary - -- [Why Exercise.rs](why-exercise.md) -- [Variables](variables.md) -- [Basic Types](basic-types/intro.md) - - [Numbers](basic-types/numbers.md) - - [Char, Bool and Unit](basic-types/char-bool-unit.md) - - [Statements and Expressions](basic-types/statements-expressions.md) - - [Functions](basic-types/functions.md) -- [Ownership and Borrowing](ownership/intro.md) - - [Ownership](ownership/ownership.md) - - [Reference and Borrowing](ownership/borrowing.md) -- [Compound Types](compound-types/intro.md) - - [string and slice](compound-types/string-slice.md) - - [tuple](compound-types/tuple.md) - - [struct](compound-types/struct.md) - - [enum](compound-types/enum.md) - - [array](compound-types/array.md) -- [Flow Control](flow-control.md) -- [Pattern Match](pattern-match/intro.md) - - [match, if let](pattern-match/match-iflet.md) - - [Option destructing](pattern-match/option.md) - - [Patterns](pattern-match/patterns.md) -- [Method](method.md) -- [Generics and Traits](generics-traits/intro.md) - - [Generics](generics-traits/generics.md) - - [Traits](generics-traits/traits.md) - - [Trait Object](generics-traits/trait-object.md) - - [Advance Traits](generics-traits/advance-traits.md) -- [Collection Types](collections/intro.md) - - [Vector](collections/vector.md) - - [HashMap](collections/hashmap.md) -- [Type Conversion](type-conversion.md) -- [Result and panic](result-panic/intro.md) - - [panic!](result-panic/panic.md) - - [result and ?](result-panic/result.md) -- [Crate and module](crate-module/intro.md) - - [Crate](crate-module/crate.md) - - [Module](crate-module/module.md) - - [use and pub](crate-module/use-pub.md) -- [Comments and Docs](comments-docs.md) -- [Formatted output](formatted-output.md) -- [Lifetime](lifetime/intro.md) - - [basic](lifetime/basic.md) - - [&'static and T: 'static](lifetime/static.md) - - [advance](lifetime/advance.md) -- [Functional programing](functional-programing/intro.md) - - [Closure](functional-programing/cloure.md) - - [Iterator](functional-programing/iterator.md) -- [newtype and Sized](newtype-sized.md) -- [Smart pointers](smart-pointers/intro.md) - - [Box](smart-pointers/box.md) - - [Deref](smart-pointers/deref.md) - - [Drop](smart-pointers/drop.md) - - [Rc and Arc](smart-pointers/rc-arc.md) - - [Cell and RefCell](smart-pointers/cell-refcell.md) -- [Weak and Circle reference](weak.md) -- [Self referential](self-referential.md) -- [Threads](threads/intro.md) - - [Basic using](threads/basic-using.md) - - [Message passing](threads/message-passing.md) - - [Sync](threads/sync.md) - - [Atomic](threads/atomic.md) - - [Send and Sync](threads/send-sync.md) -- [Global variables](global-variables.md) -- [Errors](errors.md) -- [unsafe](unsafe.md) -- [macro](macro.md) -- [Tests](tests/intro.md) - - [Write Tests](tests/write-tests.md) - - [Benchmark](tests/benchmark.md) - - [Unit and Integration](tests/unit-integration.md) - - [Assertions](tests/assertions.md) -- [Async/Await](async/intro.md) - - [async and await!](async/async-await.md) - - [Future](async/future.md) - - [Pin and Unpin](async/pin-unpin.md) - - [Stream](async/stream.md) - \ No newline at end of file diff --git a/zh/src/async/async-await.md b/zh/src/async/async-await.md deleted file mode 100644 index a20c0b8..0000000 --- a/zh/src/async/async-await.md +++ /dev/null @@ -1 +0,0 @@ -# async and await! diff --git a/zh/src/async/future.md b/zh/src/async/future.md deleted file mode 100644 index 5f24b0e..0000000 --- a/zh/src/async/future.md +++ /dev/null @@ -1 +0,0 @@ -# Future diff --git a/zh/src/async/intro.md b/zh/src/async/intro.md deleted file mode 100644 index 70bdb9f..0000000 --- a/zh/src/async/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Async/Await diff --git a/zh/src/async/pin-unpin.md b/zh/src/async/pin-unpin.md deleted file mode 100644 index 8655bd1..0000000 --- a/zh/src/async/pin-unpin.md +++ /dev/null @@ -1 +0,0 @@ -# Pin and Unpin diff --git a/zh/src/async/stream.md b/zh/src/async/stream.md deleted file mode 100644 index 867bd88..0000000 --- a/zh/src/async/stream.md +++ /dev/null @@ -1 +0,0 @@ -# Stream diff --git a/zh/src/basic-types/char-bool-unit.md b/zh/src/basic-types/char-bool-unit.md deleted file mode 100644 index b406dee..0000000 --- a/zh/src/basic-types/char-bool-unit.md +++ /dev/null @@ -1 +0,0 @@ -# Char, Bool and Unit diff --git a/zh/src/basic-types/functions.md b/zh/src/basic-types/functions.md deleted file mode 100644 index 0c5faf5..0000000 --- a/zh/src/basic-types/functions.md +++ /dev/null @@ -1 +0,0 @@ -# Functions diff --git a/zh/src/basic-types/intro.md b/zh/src/basic-types/intro.md deleted file mode 100644 index 2d47759..0000000 --- a/zh/src/basic-types/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Basic Types diff --git a/zh/src/basic-types/numbers.md b/zh/src/basic-types/numbers.md deleted file mode 100644 index bbdcf5e..0000000 --- a/zh/src/basic-types/numbers.md +++ /dev/null @@ -1 +0,0 @@ -# Numbers diff --git a/zh/src/basic-types/statements-expressions.md b/zh/src/basic-types/statements-expressions.md deleted file mode 100644 index d1f2555..0000000 --- a/zh/src/basic-types/statements-expressions.md +++ /dev/null @@ -1 +0,0 @@ -# Statements and Expressions diff --git a/zh/src/circle-refer b/zh/src/circle-refer deleted file mode 100644 index 04b7a8f..0000000 --- a/zh/src/circle-refer +++ /dev/null @@ -1 +0,0 @@ -# Weak and Circle reference diff --git a/zh/src/circle-reference/intro.md b/zh/src/circle-reference/intro.md deleted file mode 100644 index 4f99ca5..0000000 --- a/zh/src/circle-reference/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Circle reference and Self referential diff --git a/zh/src/collections/hashmap.md b/zh/src/collections/hashmap.md deleted file mode 100644 index 96e549d..0000000 --- a/zh/src/collections/hashmap.md +++ /dev/null @@ -1 +0,0 @@ -# HashMap diff --git a/zh/src/collections/intro.md b/zh/src/collections/intro.md deleted file mode 100644 index 1bdd607..0000000 --- a/zh/src/collections/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Collection Types diff --git a/zh/src/collections/vector.md b/zh/src/collections/vector.md deleted file mode 100644 index a2303c1..0000000 --- a/zh/src/collections/vector.md +++ /dev/null @@ -1 +0,0 @@ -# Vector diff --git a/zh/src/comments-docs.md b/zh/src/comments-docs.md deleted file mode 100644 index cb7d70d..0000000 --- a/zh/src/comments-docs.md +++ /dev/null @@ -1 +0,0 @@ -# Comments and Docs diff --git a/zh/src/compound-types/array.md b/zh/src/compound-types/array.md deleted file mode 100644 index 92c587c..0000000 --- a/zh/src/compound-types/array.md +++ /dev/null @@ -1 +0,0 @@ -# array diff --git a/zh/src/compound-types/enum.md b/zh/src/compound-types/enum.md deleted file mode 100644 index 298e31d..0000000 --- a/zh/src/compound-types/enum.md +++ /dev/null @@ -1 +0,0 @@ -# enum diff --git a/zh/src/compound-types/intro.md b/zh/src/compound-types/intro.md deleted file mode 100644 index 0c35451..0000000 --- a/zh/src/compound-types/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Compound Types diff --git a/zh/src/compound-types/string-slice.md b/zh/src/compound-types/string-slice.md deleted file mode 100644 index 9f17363..0000000 --- a/zh/src/compound-types/string-slice.md +++ /dev/null @@ -1 +0,0 @@ -# string and slice diff --git a/zh/src/compound-types/struct.md b/zh/src/compound-types/struct.md deleted file mode 100644 index 4b9489b..0000000 --- a/zh/src/compound-types/struct.md +++ /dev/null @@ -1 +0,0 @@ -# struct diff --git a/zh/src/compound-types/tuple.md b/zh/src/compound-types/tuple.md deleted file mode 100644 index ebbc1a7..0000000 --- a/zh/src/compound-types/tuple.md +++ /dev/null @@ -1 +0,0 @@ -# tuple diff --git a/zh/src/crate b/zh/src/crate deleted file mode 100644 index e66fb06..0000000 --- a/zh/src/crate +++ /dev/null @@ -1 +0,0 @@ -# Crate diff --git a/zh/src/crate-module/crate.md b/zh/src/crate-module/crate.md deleted file mode 100644 index e66fb06..0000000 --- a/zh/src/crate-module/crate.md +++ /dev/null @@ -1 +0,0 @@ -# Crate diff --git a/zh/src/crate-module/intro.md b/zh/src/crate-module/intro.md deleted file mode 100644 index dadbf20..0000000 --- a/zh/src/crate-module/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Crate and module diff --git a/zh/src/crate-module/module.md b/zh/src/crate-module/module.md deleted file mode 100644 index b785ceb..0000000 --- a/zh/src/crate-module/module.md +++ /dev/null @@ -1 +0,0 @@ -# Module diff --git a/zh/src/crate-module/use-pub.md b/zh/src/crate-module/use-pub.md deleted file mode 100644 index 60c6894..0000000 --- a/zh/src/crate-module/use-pub.md +++ /dev/null @@ -1 +0,0 @@ -# use and pub diff --git a/zh/src/errors.md b/zh/src/errors.md deleted file mode 100644 index 165d08c..0000000 --- a/zh/src/errors.md +++ /dev/null @@ -1 +0,0 @@ -# Errors diff --git a/zh/src/flow-control.md b/zh/src/flow-control.md deleted file mode 100644 index cf0c99f..0000000 --- a/zh/src/flow-control.md +++ /dev/null @@ -1 +0,0 @@ -# Flow Control diff --git a/zh/src/formatted-output.md b/zh/src/formatted-output.md deleted file mode 100644 index 5cd8a3b..0000000 --- a/zh/src/formatted-output.md +++ /dev/null @@ -1 +0,0 @@ -# Formatted output diff --git a/zh/src/functional-programing/cloure.md b/zh/src/functional-programing/cloure.md deleted file mode 100644 index fb73740..0000000 --- a/zh/src/functional-programing/cloure.md +++ /dev/null @@ -1,51 +0,0 @@ -# Closure - -下面代码是Rust圣经课程中[闭包](http://course.rs/advance/functional-programing/closure.html#结构体中的闭包)章节的课内练习题答案: - -```rust -struct Cacher -where - T: Fn(E) -> E, - E: Copy -{ - query: T, - value: Option, -} - -impl Cacher -where - T: Fn(E) -> E, - E: Copy -{ - fn new(query: T) -> Cacher { - Cacher { - query, - value: None, - } - } - - fn value(&mut self, arg: E) -> E { - match self.value { - Some(v) => v, - None => { - let v = (self.query)(arg); - self.value = Some(v); - v - } - } - } -} -fn main() { - -} - -#[test] -fn call_with_different_values() { - let mut c = Cacher::new(|a| a); - - let v1 = c.value(1); - let v2 = c.value(2); - - assert_eq!(v2, 1); -} -``` \ No newline at end of file diff --git a/zh/src/functional-programing/intro.md b/zh/src/functional-programing/intro.md deleted file mode 100644 index 6f326b8..0000000 --- a/zh/src/functional-programing/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Functional programing diff --git a/zh/src/functional-programing/iterator.md b/zh/src/functional-programing/iterator.md deleted file mode 100644 index 2a4a2aa..0000000 --- a/zh/src/functional-programing/iterator.md +++ /dev/null @@ -1 +0,0 @@ -# Iterator diff --git a/zh/src/functional-programming/closure.md b/zh/src/functional-programming/closure.md deleted file mode 100644 index fb73740..0000000 --- a/zh/src/functional-programming/closure.md +++ /dev/null @@ -1,51 +0,0 @@ -# Closure - -下面代码是Rust圣经课程中[闭包](http://course.rs/advance/functional-programing/closure.html#结构体中的闭包)章节的课内练习题答案: - -```rust -struct Cacher -where - T: Fn(E) -> E, - E: Copy -{ - query: T, - value: Option, -} - -impl Cacher -where - T: Fn(E) -> E, - E: Copy -{ - fn new(query: T) -> Cacher { - Cacher { - query, - value: None, - } - } - - fn value(&mut self, arg: E) -> E { - match self.value { - Some(v) => v, - None => { - let v = (self.query)(arg); - self.value = Some(v); - v - } - } - } -} -fn main() { - -} - -#[test] -fn call_with_different_values() { - let mut c = Cacher::new(|a| a); - - let v1 = c.value(1); - let v2 = c.value(2); - - assert_eq!(v2, 1); -} -``` \ No newline at end of file diff --git a/zh/src/functional-programming/intro.md b/zh/src/functional-programming/intro.md deleted file mode 100644 index dca041e..0000000 --- a/zh/src/functional-programming/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Functional Programming diff --git a/zh/src/generics-traits/advance-traits.md b/zh/src/generics-traits/advance-traits.md deleted file mode 100644 index 8cd2f63..0000000 --- a/zh/src/generics-traits/advance-traits.md +++ /dev/null @@ -1 +0,0 @@ -# Advance Traits diff --git a/zh/src/generics-traits/generics.md b/zh/src/generics-traits/generics.md deleted file mode 100644 index 292d26b..0000000 --- a/zh/src/generics-traits/generics.md +++ /dev/null @@ -1 +0,0 @@ -# Generics diff --git a/zh/src/generics-traits/intro.md b/zh/src/generics-traits/intro.md deleted file mode 100644 index 340ad0e..0000000 --- a/zh/src/generics-traits/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Generics and Traits diff --git a/zh/src/generics-traits/trait-object.md b/zh/src/generics-traits/trait-object.md deleted file mode 100644 index 38a0b34..0000000 --- a/zh/src/generics-traits/trait-object.md +++ /dev/null @@ -1 +0,0 @@ -# Trait Object diff --git a/zh/src/generics-traits/traits.md b/zh/src/generics-traits/traits.md deleted file mode 100644 index 445d444..0000000 --- a/zh/src/generics-traits/traits.md +++ /dev/null @@ -1 +0,0 @@ -# Traits diff --git a/zh/src/global-variables.md b/zh/src/global-variables.md deleted file mode 100644 index ad85421..0000000 --- a/zh/src/global-variables.md +++ /dev/null @@ -1 +0,0 @@ -# Global variables diff --git a/zh/src/lifetime/advance.md b/zh/src/lifetime/advance.md deleted file mode 100644 index 4ee0e07..0000000 --- a/zh/src/lifetime/advance.md +++ /dev/null @@ -1 +0,0 @@ -# advance diff --git a/zh/src/lifetime/basic.md b/zh/src/lifetime/basic.md deleted file mode 100644 index 40439f4..0000000 --- a/zh/src/lifetime/basic.md +++ /dev/null @@ -1,26 +0,0 @@ -## 生命周期消除 - -```rust -fn print(s: &str); // elided -fn print<'a>(s: &'a str); // expanded - -fn debug(lvl: usize, s: &str); // elided -fn debug<'a>(lvl: usize, s: &'a str); // expanded - -fn substr(s: &str, until: usize) -> &str; // elided -fn substr<'a>(s: &'a str, until: usize) -> &'a str; // expanded - -fn get_str() -> &str; // ILLEGAL - -fn frob(s: &str, t: &str) -> &str; // ILLEGAL - -fn get_mut(&mut self) -> &mut T; // elided -fn get_mut<'a>(&'a mut self) -> &'a mut T; // expanded - -fn args(&mut self, args: &[T]) -> &mut Command // elided -fn args<'a, 'b, T: ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command // expanded - -fn new(buf: &mut [u8]) -> BufWriter; // elided -fn new(buf: &mut [u8]) -> BufWriter<'_>; // elided (with `rust_2018_idioms`) -fn new<'a>(buf: &'a mut [u8]) -> BufWriter<'a> // expanded -``` \ No newline at end of file diff --git a/zh/src/lifetime/intro.md b/zh/src/lifetime/intro.md deleted file mode 100644 index 2615315..0000000 --- a/zh/src/lifetime/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Lifetime diff --git a/zh/src/lifetime/static.md b/zh/src/lifetime/static.md deleted file mode 100644 index 782446e..0000000 --- a/zh/src/lifetime/static.md +++ /dev/null @@ -1,49 +0,0 @@ -# &'static and T: 'static - -```rust,editable -use std::fmt::Display; - -fn main() { - let mut string = "First".to_owned(); - - string.push_str(string.to_uppercase().as_str()); - print_a(&string); - print_b(&string); - print_c(&string); // Compilation error - print_d(&string); // Compilation error - print_e(&string); - print_f(&string); - print_g(&string); // Compilation error -} - -fn print_a(t: &T) { - println!("{}", t); -} - -fn print_b(t: &T) -where - T: Display + 'static, -{ - println!("{}", t); -} - -fn print_c(t: &'static dyn Display) { - println!("{}", t) -} - -fn print_d(t: &'static impl Display) { - println!("{}", t) -} - -fn print_e(t: &(dyn Display + 'static)) { - println!("{}", t) -} - -fn print_f(t: &(impl Display + 'static)) { - println!("{}", t) -} - -fn print_g(t: &'static String) { - println!("{}", t); -} -``` \ No newline at end of file diff --git a/zh/src/macro.md b/zh/src/macro.md deleted file mode 100644 index 20503ba..0000000 --- a/zh/src/macro.md +++ /dev/null @@ -1 +0,0 @@ -# macro diff --git a/zh/src/method.md b/zh/src/method.md deleted file mode 100644 index 81d5a1c..0000000 --- a/zh/src/method.md +++ /dev/null @@ -1 +0,0 @@ -# Method diff --git a/zh/src/newtype-sized.md b/zh/src/newtype-sized.md deleted file mode 100644 index fc3f074..0000000 --- a/zh/src/newtype-sized.md +++ /dev/null @@ -1 +0,0 @@ -# newtype and Sized diff --git a/zh/src/ownership/borrowing.md b/zh/src/ownership/borrowing.md deleted file mode 100644 index 9ce0535..0000000 --- a/zh/src/ownership/borrowing.md +++ /dev/null @@ -1 +0,0 @@ -# Reference and Borrowing diff --git a/zh/src/ownership/intro.md b/zh/src/ownership/intro.md deleted file mode 100644 index e749a67..0000000 --- a/zh/src/ownership/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Ownership and Borrowing diff --git a/zh/src/ownership/ownership.md b/zh/src/ownership/ownership.md deleted file mode 100644 index 77f5a52..0000000 --- a/zh/src/ownership/ownership.md +++ /dev/null @@ -1 +0,0 @@ -# Ownership diff --git a/zh/src/pattern-match/intro.md b/zh/src/pattern-match/intro.md deleted file mode 100644 index ee4bb18..0000000 --- a/zh/src/pattern-match/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Pattern Match diff --git a/zh/src/pattern-match/match-iflet.md b/zh/src/pattern-match/match-iflet.md deleted file mode 100644 index 18eed0e..0000000 --- a/zh/src/pattern-match/match-iflet.md +++ /dev/null @@ -1 +0,0 @@ -# match, if let diff --git a/zh/src/pattern-match/option.md b/zh/src/pattern-match/option.md deleted file mode 100644 index cb5ffa1..0000000 --- a/zh/src/pattern-match/option.md +++ /dev/null @@ -1 +0,0 @@ -# Option destructing diff --git a/zh/src/pattern-match/patterns.md b/zh/src/pattern-match/patterns.md deleted file mode 100644 index 3c9daa3..0000000 --- a/zh/src/pattern-match/patterns.md +++ /dev/null @@ -1 +0,0 @@ -# Patterns diff --git a/zh/src/resu b/zh/src/resu deleted file mode 100644 index b82dd9a..0000000 --- a/zh/src/resu +++ /dev/null @@ -1 +0,0 @@ -# panic! diff --git a/zh/src/result-panic/intro.md b/zh/src/result-panic/intro.md deleted file mode 100644 index f724a70..0000000 --- a/zh/src/result-panic/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Result and panic diff --git a/zh/src/result-panic/panic.md b/zh/src/result-panic/panic.md deleted file mode 100644 index b82dd9a..0000000 --- a/zh/src/result-panic/panic.md +++ /dev/null @@ -1 +0,0 @@ -# panic! diff --git a/zh/src/result-panic/result.md b/zh/src/result-panic/result.md deleted file mode 100644 index 7af6baf..0000000 --- a/zh/src/result-panic/result.md +++ /dev/null @@ -1 +0,0 @@ -# result and ? diff --git a/zh/src/self-referential.md b/zh/src/self-referential.md deleted file mode 100644 index 37a4784..0000000 --- a/zh/src/self-referential.md +++ /dev/null @@ -1 +0,0 @@ -# Self referential diff --git a/zh/src/smart-pointers/box.md b/zh/src/smart-pointers/box.md deleted file mode 100644 index 2436f01..0000000 --- a/zh/src/smart-pointers/box.md +++ /dev/null @@ -1 +0,0 @@ -# Box diff --git a/zh/src/smart-pointers/cell-refcell.md b/zh/src/smart-pointers/cell-refcell.md deleted file mode 100644 index 4e61a02..0000000 --- a/zh/src/smart-pointers/cell-refcell.md +++ /dev/null @@ -1 +0,0 @@ -# Cell and RefCell diff --git a/zh/src/smart-pointers/deref.md b/zh/src/smart-pointers/deref.md deleted file mode 100644 index 8c709e8..0000000 --- a/zh/src/smart-pointers/deref.md +++ /dev/null @@ -1 +0,0 @@ -# Deref diff --git a/zh/src/smart-pointers/drop.md b/zh/src/smart-pointers/drop.md deleted file mode 100644 index c6ecf82..0000000 --- a/zh/src/smart-pointers/drop.md +++ /dev/null @@ -1 +0,0 @@ -# Drop diff --git a/zh/src/smart-pointers/intro.md b/zh/src/smart-pointers/intro.md deleted file mode 100644 index 997d50c..0000000 --- a/zh/src/smart-pointers/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Smart pointers diff --git a/zh/src/smart-pointers/rc-arc.md b/zh/src/smart-pointers/rc-arc.md deleted file mode 100644 index 8f723ed..0000000 --- a/zh/src/smart-pointers/rc-arc.md +++ /dev/null @@ -1 +0,0 @@ -# Rc and Arc diff --git a/zh/src/tests/assertions.md b/zh/src/tests/assertions.md deleted file mode 100644 index f5743ab..0000000 --- a/zh/src/tests/assertions.md +++ /dev/null @@ -1 +0,0 @@ -# Assertions diff --git a/zh/src/tests/benchmark.md b/zh/src/tests/benchmark.md deleted file mode 100644 index f883201..0000000 --- a/zh/src/tests/benchmark.md +++ /dev/null @@ -1,3 +0,0 @@ -# Benchmark - -https://doc.rust-lang.org/unstable-book/library-features/test.html \ No newline at end of file diff --git a/zh/src/tests/intro.md b/zh/src/tests/intro.md deleted file mode 100644 index 007eb95..0000000 --- a/zh/src/tests/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Tests diff --git a/zh/src/tests/unit-integration.md b/zh/src/tests/unit-integration.md deleted file mode 100644 index 68df7e4..0000000 --- a/zh/src/tests/unit-integration.md +++ /dev/null @@ -1 +0,0 @@ -# Unit and Integration diff --git a/zh/src/tests/write-tests.md b/zh/src/tests/write-tests.md deleted file mode 100644 index 245c701..0000000 --- a/zh/src/tests/write-tests.md +++ /dev/null @@ -1 +0,0 @@ -# Write Tests diff --git a/zh/src/threads/atomic.md b/zh/src/threads/atomic.md deleted file mode 100644 index eecfaa8..0000000 --- a/zh/src/threads/atomic.md +++ /dev/null @@ -1 +0,0 @@ -# Atomic diff --git a/zh/src/threads/basic-using.md b/zh/src/threads/basic-using.md deleted file mode 100644 index f0a2d46..0000000 --- a/zh/src/threads/basic-using.md +++ /dev/null @@ -1 +0,0 @@ -# Basic using diff --git a/zh/src/threads/intro.md b/zh/src/threads/intro.md deleted file mode 100644 index f60f399..0000000 --- a/zh/src/threads/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Threads diff --git a/zh/src/threads/message-passing.md b/zh/src/threads/message-passing.md deleted file mode 100644 index 4d33941..0000000 --- a/zh/src/threads/message-passing.md +++ /dev/null @@ -1 +0,0 @@ -# Message passing diff --git a/zh/src/threads/send-sync.md b/zh/src/threads/send-sync.md deleted file mode 100644 index 171f95f..0000000 --- a/zh/src/threads/send-sync.md +++ /dev/null @@ -1 +0,0 @@ -# Send and Sync diff --git a/zh/src/threads/sync.md b/zh/src/threads/sync.md deleted file mode 100644 index bc4491e..0000000 --- a/zh/src/threads/sync.md +++ /dev/null @@ -1 +0,0 @@ -# Sync diff --git a/zh/src/type-conversion.md b/zh/src/type-conversion.md deleted file mode 100644 index 7b930e5..0000000 --- a/zh/src/type-conversion.md +++ /dev/null @@ -1 +0,0 @@ -# Type Conversion diff --git a/zh/src/unsafe.md b/zh/src/unsafe.md deleted file mode 100644 index df49df6..0000000 --- a/zh/src/unsafe.md +++ /dev/null @@ -1 +0,0 @@ -# unsafe diff --git a/zh/src/variables.md b/zh/src/variables.md deleted file mode 100644 index ee1fba4..0000000 --- a/zh/src/variables.md +++ /dev/null @@ -1 +0,0 @@ -# Variables diff --git a/zh/src/weak.md b/zh/src/weak.md deleted file mode 100644 index 04b7a8f..0000000 --- a/zh/src/weak.md +++ /dev/null @@ -1 +0,0 @@ -# Weak and Circle reference diff --git a/zh/src/why-exercise.md b/zh/src/why-exercise.md deleted file mode 100644 index c3e5e3f..0000000 --- a/zh/src/why-exercise.md +++ /dev/null @@ -1 +0,0 @@ -# Why Exercise.rs