pub struct ColorFile {
pub entries: Vec<ColorEntry>,
}Fields§
§entries: Vec<ColorEntry>Implementations§
Source§impl ColorFile
impl ColorFile
pub fn new(colors: Vec<String>) -> ColorFile
pub fn create_lookup(&self) -> HashMap<Rgba<u8>, String>
Sourcepub fn write(&self, path: &str) -> Result<()>
pub fn write(&self, path: &str) -> Result<()>
Examples found in repository?
examples/color-file.rs (line 15)
3fn main() -> std::io::Result<()> {
4 let e1 = ColorEntry {
5 name: String::from("thing1"),
6 color: String::from("#123abc"),
7 };
8 let e2 = ColorEntry {
9 name: String::from("thing2"),
10 color: String::from("#abc123"),
11 };
12 let cf = ColorFile {
13 entries: vec![e1, e2],
14 };
15 cf.write("examples/example-color-file.ron")?;
16 Ok(())
17}Trait Implementations§
Source§impl<'de> Deserialize<'de> for ColorFile
impl<'de> Deserialize<'de> for ColorFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ColorFile
impl RefUnwindSafe for ColorFile
impl Send for ColorFile
impl Sync for ColorFile
impl Unpin for ColorFile
impl UnwindSafe for ColorFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more