965 B
965 B
DeaDvey's domain
Home page Blogs Resources
Rust:
Useful resources:
How to do some random things:
-
Colors and effects in the terminal with Colored: %%% // Cargo.toml colored = "2.2.0"
// program.rs use colored::Colorize;
println!("{}", "red text".red()); println!("{}", "green background".on_green()); println!("{}", "bold text".bold()); %%%
-
Search and replace (example): %%% let strikethrough_regex = Regex::new(r"
(.*?)").unwrap(); // Define the search patternlet parsed_line: String = strikethrough_regex.replace_all(&parsed_line, |caps: ®ex::Captures| { // Assign a variable to the changed value, if there's a match caps[1].strikethrough().to_string() // This is the replaced value, that is returned from this function }).to_string();
%%%