rebased to use custom struct over String
This commit is contained in:
1 parent
b00ef93c1c
commit
135274c9c5
4 files changed
+53
-26
No files matched your search
@@ -0,0 +1,29 @@
|
||||
|
||||
pub struct RGB {
|
||||
pub r: u8,
|
||||
pub g: u8,
|
||||
pub b: u8,
|
||||
}
|
||||
|
||||
pub struct Ascii {
|
||||
pub char: char,
|
||||
pub rgb: RGB,
|
||||
}
|
||||
|
||||
|
||||
impl Ascii {
|
||||
fn _new(char: char, r: u8, g: u8, b: u8) -> Self {
|
||||
Ascii {
|
||||
char,
|
||||
rgb: RGB {
|
||||
r,
|
||||
g,
|
||||
b,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(ch: u8, r: u8, g: u8, b: u8) -> Self {
|
||||
Self::_new(char::from(ch), r, g, b)
|
||||
}
|
||||
}
|
||||