@@ -11,7 +11,7 @@ use std::io::{self, prelude::*};
1111use std:: path:: Path ;
1212use std:: process:: { Command , Stdio } ;
1313use std:: sync:: atomic:: { AtomicBool , Ordering } ;
14- use std:: sync:: mpsc:: { RecvTimeoutError , channel } ;
14+ use std:: sync:: mpsc:: { channel , RecvTimeoutError } ;
1515use std:: sync:: { Arc , Mutex } ;
1616use std:: thread;
1717use std:: time:: Duration ;
@@ -24,7 +24,7 @@ mod run;
2424mod verify;
2525
2626// In sync with crate version
27- const VERSION : & str = "4.5 .0" ;
27+ const VERSION : & str = "4.6 .0" ;
2828
2929#[ derive( FromArgs , PartialEq , Debug ) ]
3030/// Rustlings is a collection of small exercises to get you used to writing and reading Rust code
@@ -217,61 +217,64 @@ fn main() {
217217 verify ( & exercises, verbose) . unwrap_or_else ( |_| std:: process:: exit ( 1 ) ) ;
218218 }
219219
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 ) ;
269228 }
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+ } ,
271271 }
272272}
273273
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+ ) {
275278 let failed_exercise_hint = Arc :: clone ( failed_exercise_hint) ;
276279 println ! ( "Welcome to watch mode! You can type 'help' to get an overview of the commands you can use here." ) ;
277280 thread:: spawn ( move || loop {
0 commit comments