@@ -11,7 +11,7 @@ use std::io::{self, prelude::*};
11
11
use std:: path:: Path ;
12
12
use std:: process:: { Command , Stdio } ;
13
13
use std:: sync:: atomic:: { AtomicBool , Ordering } ;
14
- use std:: sync:: mpsc:: { RecvTimeoutError , channel } ;
14
+ use std:: sync:: mpsc:: { channel , RecvTimeoutError } ;
15
15
use std:: sync:: { Arc , Mutex } ;
16
16
use std:: thread;
17
17
use std:: time:: Duration ;
@@ -24,7 +24,7 @@ mod run;
24
24
mod verify;
25
25
26
26
// In sync with crate version
27
- const VERSION : & str = "4.5 .0" ;
27
+ const VERSION : & str = "4.6 .0" ;
28
28
29
29
#[ derive( FromArgs , PartialEq , Debug ) ]
30
30
/// Rustlings is a collection of small exercises to get you used to writing and reading Rust code
@@ -217,61 +217,64 @@ fn main() {
217
217
verify ( & exercises, verbose) . unwrap_or_else ( |_| std:: process:: exit ( 1 ) ) ;
218
218
}
219
219
220
- Subcommands :: Watch ( _subargs) => {
221
- match watch ( & exercises, verbose) {
222
- Err ( e) => {
223
- println ! (
224
- "Error: Could not watch your progress. Error message was {:?}." ,
225
- e
226
- ) ;
227
- println ! ( "Most likely you've run out of disk space or your 'inotify limit' has been reached." ) ;
228
- std:: process:: exit ( 1 ) ;
229
- }
230
- Ok ( WatchStatus :: Finished ) => {
231
- println ! (
232
- "{emoji} All exercises completed! {emoji}" ,
233
- emoji = Emoji ( "🎉" , "★" )
234
- ) ;
235
- println ! ( ) ;
236
- println ! ( "+----------------------------------------------------+" ) ;
237
- println ! ( "| You made it to the Fe-nish line! |" ) ;
238
- println ! ( "+-------------------------- ------------------------+" ) ;
239
- println ! ( " \\ / " ) ;
240
- println ! ( " ▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒ " ) ;
241
- println ! ( " ▒▒▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒▒▒ " ) ;
242
- println ! ( " ▒▒▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒▒▒ " ) ;
243
- println ! ( " ░░▒▒▒▒░░▒▒ ▒▒ ▒▒ ▒▒ ▒▒░░▒▒▒▒ " ) ;
244
- println ! ( " ▓▓▓▓▓▓▓▓ ▓▓ ▓▓██ ▓▓ ▓▓██ ▓▓ ▓▓▓▓▓▓▓▓ " ) ;
245
- println ! ( " ▒▒▒▒ ▒▒ ████ ▒▒ ████ ▒▒░░ ▒▒▒▒ " ) ;
246
- println ! ( " ▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒▒ ▒▒ " ) ;
247
- println ! ( " ▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒▓▓▒▒▓▓▒▒▒▒▒▒▒▒ " ) ;
248
- println ! ( " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ " ) ;
249
- println ! ( " ▒▒▒▒▒▒▒▒▒▒██▒▒▒▒▒▒██▒▒▒▒▒▒▒▒▒▒ " ) ;
250
- println ! ( " ▒▒ ▒▒▒▒▒▒▒▒▒▒██████▒▒▒▒▒▒▒▒▒▒ ▒▒ " ) ;
251
- println ! ( " ▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ " ) ;
252
- println ! ( " ▒▒ ▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ▒▒ " ) ;
253
- println ! ( " ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ " ) ;
254
- println ! ( " ▒▒ ▒▒ ▒▒ ▒▒ " ) ;
255
- println ! ( ) ;
256
- println ! ( "We hope you enjoyed learning about the various aspects of Rust!" ) ;
257
- println ! (
258
- "If you noticed any issues, please don't hesitate to report them to our repo."
259
- ) ;
260
- println ! ( "You can also contribute your own exercises to help the greater community!" ) ;
261
- println ! ( ) ;
262
- println ! ( "Before reporting an issue or contributing, please read our guidelines:" ) ;
263
- println ! ( "https://github.com/rust-lang/rustlings/blob/main/CONTRIBUTING.md" ) ;
264
- }
265
- Ok ( WatchStatus :: Unfinished ) => {
266
- println ! ( "We hope you're enjoying learning about Rust!" ) ;
267
- println ! ( "If you want to continue working on the exercises at a later point, you can simply run `rustlings watch` again" ) ;
268
- }
220
+ Subcommands :: Watch ( _subargs) => match watch ( & exercises, verbose) {
221
+ Err ( e) => {
222
+ println ! (
223
+ "Error: Could not watch your progress. Error message was {:?}." ,
224
+ e
225
+ ) ;
226
+ println ! ( "Most likely you've run out of disk space or your 'inotify limit' has been reached." ) ;
227
+ std:: process:: exit ( 1 ) ;
269
228
}
270
- }
229
+ Ok ( WatchStatus :: Finished ) => {
230
+ println ! (
231
+ "{emoji} All exercises completed! {emoji}" ,
232
+ emoji = Emoji ( "🎉" , "★" )
233
+ ) ;
234
+ println ! ( ) ;
235
+ println ! ( "+----------------------------------------------------+" ) ;
236
+ println ! ( "| You made it to the Fe-nish line! |" ) ;
237
+ println ! ( "+-------------------------- ------------------------+" ) ;
238
+ println ! ( " \\ / " ) ;
239
+ println ! ( " ▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒ " ) ;
240
+ println ! ( " ▒▒▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒▒▒ " ) ;
241
+ println ! ( " ▒▒▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒▒▒ " ) ;
242
+ println ! ( " ░░▒▒▒▒░░▒▒ ▒▒ ▒▒ ▒▒ ▒▒░░▒▒▒▒ " ) ;
243
+ println ! ( " ▓▓▓▓▓▓▓▓ ▓▓ ▓▓██ ▓▓ ▓▓██ ▓▓ ▓▓▓▓▓▓▓▓ " ) ;
244
+ println ! ( " ▒▒▒▒ ▒▒ ████ ▒▒ ████ ▒▒░░ ▒▒▒▒ " ) ;
245
+ println ! ( " ▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒▒ ▒▒ " ) ;
246
+ println ! ( " ▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒▓▓▒▒▓▓▒▒▒▒▒▒▒▒ " ) ;
247
+ println ! ( " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ " ) ;
248
+ println ! ( " ▒▒▒▒▒▒▒▒▒▒██▒▒▒▒▒▒██▒▒▒▒▒▒▒▒▒▒ " ) ;
249
+ println ! ( " ▒▒ ▒▒▒▒▒▒▒▒▒▒██████▒▒▒▒▒▒▒▒▒▒ ▒▒ " ) ;
250
+ println ! ( " ▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ " ) ;
251
+ println ! ( " ▒▒ ▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒ ▒▒ " ) ;
252
+ println ! ( " ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ " ) ;
253
+ println ! ( " ▒▒ ▒▒ ▒▒ ▒▒ " ) ;
254
+ println ! ( ) ;
255
+ println ! ( "We hope you enjoyed learning about the various aspects of Rust!" ) ;
256
+ println ! (
257
+ "If you noticed any issues, please don't hesitate to report them to our repo."
258
+ ) ;
259
+ println ! (
260
+ "You can also contribute your own exercises to help the greater community!"
261
+ ) ;
262
+ println ! ( ) ;
263
+ println ! ( "Before reporting an issue or contributing, please read our guidelines:" ) ;
264
+ println ! ( "https://github.com/rust-lang/rustlings/blob/main/CONTRIBUTING.md" ) ;
265
+ }
266
+ Ok ( WatchStatus :: Unfinished ) => {
267
+ println ! ( "We hope you're enjoying learning about Rust!" ) ;
268
+ println ! ( "If you want to continue working on the exercises at a later point, you can simply run `rustlings watch` again" ) ;
269
+ }
270
+ } ,
271
271
}
272
272
}
273
273
274
- fn spawn_watch_shell ( failed_exercise_hint : & Arc < Mutex < Option < String > > > , should_quit : Arc < AtomicBool > ) {
274
+ fn spawn_watch_shell (
275
+ failed_exercise_hint : & Arc < Mutex < Option < String > > > ,
276
+ should_quit : Arc < AtomicBool > ,
277
+ ) {
275
278
let failed_exercise_hint = Arc :: clone ( failed_exercise_hint) ;
276
279
println ! ( "Welcome to watch mode! You can type 'help' to get an overview of the commands you can use here." ) ;
277
280
thread:: spawn ( move || loop {
0 commit comments