- Is using crate clipboard-win the best (short for dev and effective for PC) way to get text from clipboard ? Is it only for Windows ? What about Linux ?
[deps]
clipboard-win
let my_clp: String = clipboard_win::get_clipboard(clipboard_win::formats::Unicode).expect("to get_clipboard");
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- ?
if ... {
println!( "Not found ...") ; // Need attention before closing
std::io::stdin().read_line(_); // Dont want to create a mut String
return; // How to keep terminal in Win ? Need pause
}
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- How do you get executable's name ?
let my_app: Vec<String> = std::env::args().collect();
let mut my_app = std::fs::OpenOptions::new()
.append(true)
.create(!false)
.open(
std::path:: Path::new(
std::path:: Path::new( & my_app [0] ). file_stem( ) .unwrap()
).with_extension( "log" )
)
.expect("To open log")
;
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- What is easy way to get timestamp ? Is it necessary to download a crate?
[deps]
chrono = "0.4"
let my_log: & str = & format !( " {}"
, chrono :: Local :: now ( ) . format ( "%a %e.%m.%Y %H:%M:%S" ) // .to_rfc2822() //
) ;
println ! ( "{} " , my_log ) ;