[−][src]Struct genie::Palette
A Palette.
Implementations
impl Palette
[src]
pub fn new() -> Palette
[src]
Create an empty palette.
pub fn read_from(input: impl Read) -> Result<Palette, ReadPaletteError>
[src]
Read a palette from an input stream.
pub fn write_to(&self, output: impl Write) -> Result<(), Error>
[src]
Write a palette to an output stream.
pub fn into_inner(self) -> Vec<RGB<u8>>
[src]
Return the colours in a Vec so it can be manipulated.
It can later be wrapped back into a Palette instance using Palette::from(vec)
.
pub fn colors(&self) -> &[RGB<u8>]
[src]
Return the colours as a slice.
pub fn colors_mut(&mut self) -> &mut Vec<RGB<u8>>
[src]
Return the colours as a mutable vector.
pub fn len(&self) -> usize
[src]
Returns the number of colours in this palette.
pub fn is_empty(&self) -> bool
[src]
Returns true
if this palette contains 0 colours.
pub fn add(&mut self, color: RGB<u8>)
[src]
Add a colour at the end of the palette.
pub fn to_bytes(&self) -> Vec<u8>
[src]
Serialize the palette to a byte vector.
Trait Implementations
impl Clone for Palette
[src]
impl Debug for Palette
[src]
impl Default for Palette
[src]
impl Eq for Palette
[src]
impl From<Vec<RGB<u8>>> for Palette
[src]
impl FromStr for Palette
[src]
type Err = ReadPaletteError
The associated error which can be returned from parsing.
fn from_str(input: &str) -> Result<Palette, <Palette as FromStr>::Err>
[src]
Parse a palette from a UTF-8 string.
impl Index<PaletteIndex> for Palette
[src]
type Output = RGB<u8>
The returned type after indexing.
fn index(
&self,
index: PaletteIndex
) -> &<Palette as Index<PaletteIndex>>::Output
[src]
&self,
index: PaletteIndex
) -> &<Palette as Index<PaletteIndex>>::Output
Get the colour at the given index.
impl IndexMut<PaletteIndex> for Palette
[src]
fn index_mut(
&mut self,
index: PaletteIndex
) -> &mut <Palette as Index<PaletteIndex>>::Output
[src]
&mut self,
index: PaletteIndex
) -> &mut <Palette as Index<PaletteIndex>>::Output
Get the colour at the given index.
impl<'a> IntoIterator for &'a Palette
[src]
type Item = &'a RGB<u8>
The type of the elements being iterated over.
type IntoIter = Iter<'a, RGB<u8>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> <&'a Palette as IntoIterator>::IntoIter
[src]
impl IntoIterator for Palette
[src]
type Item = RGB<u8>
The type of the elements being iterated over.
type IntoIter = IntoIter<RGB<u8>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> <Palette as IntoIterator>::IntoIter
[src]
impl PartialEq<Palette> for Palette
[src]
impl StructuralEq for Palette
[src]
impl StructuralPartialEq for Palette
[src]
impl ToString for Palette
[src]
Auto Trait Implementations
impl RefUnwindSafe for Palette
impl Send for Palette
impl Sync for Palette
impl Unpin for Palette
impl UnwindSafe for Palette
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,