My feature programming languages
/**
* Created at 2020/8/22 20:40
*
* @author Liangcheng Juves
*/
fn main ( ) {
println ! ( "Hello, World!" ) ;
}
/**
* Created at 2020/9/15 15:14
*
* @author Liangcheng Juves
*/
use std:: io:: { stdout, Result , Write } ;
use std:: thread:: sleep;
use std:: time:: Duration ;
fn main ( ) -> Result < ( ) > {
const BAR_LAB : & str = "-\\ |/" ;
for perc in 0 ..=100 {
print ! (
"\r {} \u{1b} [42m{}\u{1b} [0m [ {}% ] " ,
BAR_LAB . chars( ) . nth( perc % 4 ) . unwrap( ) ,
" " . repeat( perc / 2 ) ,
perc
) ;
stdout ( ) . flush ( ) ?;
sleep ( Duration :: from_micros ( 60_000 ) ) ;
}
println ! ( ) ;
Ok ( ( ) )
}
/**
* Created at 2020/11/16 22:49
*
* @author Liangcheng Juves
*/
use std:: io:: { stdout, Result , Write } ;
use std:: thread:: sleep;
use std:: time:: { Duration , SystemTime , UNIX_EPOCH } ;
fn main ( ) -> Result < ( ) > {
loop {
print ! (
"\r {}" ,
SystemTime :: now( )
. duration_since( UNIX_EPOCH )
. unwrap( )
. as_secs( )
) ;
sleep ( Duration :: from_micros ( 300 ) ) ;
stdout ( ) . flush ( ) ?
}
}
At least those who provide the best things to people for free should be respected !!!