pub struct Palette { /* private fields */ }
Implementations§
Source§impl Palette
impl Palette
Sourcepub fn new<S: ToString>(
name: S,
colors: Vec<Color>,
) -> Result<Self, NewPaletteError>
pub fn new<S: ToString>( name: S, colors: Vec<Color>, ) -> Result<Self, NewPaletteError>
Creates a new named Palette from a non-zero-length collection of Colors.
Passing a zero-length collection will result in an Err(NewPaletteError::NoColors)
Sourcepub fn read_from_file<P: AsRef<Path>>(
file_path: P,
) -> Result<Self, NewPaletteError>
pub fn read_from_file<P: AsRef<Path>>( file_path: P, ) -> Result<Self, NewPaletteError>
Creates a new Palette from a file path. TODO: Decide how to handle the ‘Columns’ header value.
pub fn get_name<'a>(&'a self) -> &'a str
pub fn get_colors<'a>(&'a self) -> &'a [Color]
pub fn write_to_file<P: AsRef<Path>>(&self, file_path: P) -> Result<(), Error>
Auto Trait Implementations§
impl Freeze for Palette
impl RefUnwindSafe for Palette
impl Send for Palette
impl Sync for Palette
impl Unpin for Palette
impl UnwindSafe for Palette
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