Compare commits

..

2 Commits

Author SHA1 Message Date
8e5596472d chore: not completed 2020-07-19 17:49:16 +08:00
2085babe94 chore: not completed 2020-07-19 17:49:08 +08:00
2 changed files with 36 additions and 1 deletions

5
colored_msg/Cargo.lock generated Normal file
View File

@@ -0,0 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "colored_msg"
version = "0.1.0"

View File

@@ -1,3 +1,33 @@
fn main() {
println!("Hello, world!");
// println!("{}", parse_color("hello world"));
}
enum Block {
String(String),
Bold,
Under,
Color(String),
TrueColor(u8, u8, u8),
EndAll,
EndBold,
EndUnder,
EndColor,
}
/// <red></red>
/// <red><bold></>
/// \\ \<
fn parse_color(msg: &str) -> Vec<Block> {
let mut parsed_blocks = vec![];
let mut msg_iter = msg.chars().peekable();
while let Some(c) = msg_iter.next() {
if c == '\\' {
// match msg_iter.next() {
// Some(c) => parsed_blocks.push(c), None => break,
// }
}
}
parsed_blocks
}