Struct palette::gradient::Slice[][src]

pub struct Slice<'a, C, T = Vec<(<C as Mix>::Scalar, C)>> where
    C: Mix + Clone + 'a,
    T: AsRef<[(C::Scalar, C)]>, 
{ /* fields omitted */ }

A slice of a Gradient that limits its domain.

Implementations

impl<'a, C, T> Slice<'a, C, T> where
    C: Mix + Clone + 'a,
    T: AsRef<[(C::Scalar, C)]>, 
[src]

pub fn get(&self, i: C::Scalar) -> C[src]

Get a color from the gradient slice. The color of the closest domain limit will be returned if i is outside the domain.

pub fn slice<R: Into<Range<C::Scalar>>>(&self, range: R) -> Slice<'_, C, T>[src]

Slice this gradient slice to further limit its domain. Ranges outside the domain will be clamped to the nearest domain limit.

pub fn domain(&self) -> (C::Scalar, C::Scalar)[src]

Get the limits of this gradient slice’s domain.

impl<'a, C, T> Slice<'a, C, T> where
    C: Mix + Clone + 'a,
    T: AsRef<[(C::Scalar, C)]> + Clone
[src]

pub fn take(&self, n: usize) -> Take<'_, C, T>

Notable traits for Take<'a, C, T>

impl<'a, C, T> Iterator for Take<'a, C, T> where
    C::Scalar: FromF64,
    C: Mix + Clone,
    T: AsRef<[(C::Scalar, C)]>, 
type Item = C;
[src]

Take n evenly spaced colors from the gradient slice, as an iterator.

Trait Implementations

impl<'a, C: Clone, T: Clone> Clone for Slice<'a, C, T> where
    C: Mix + Clone + 'a,
    T: AsRef<[(C::Scalar, C)]>,
    C::Scalar: Clone
[src]

impl<'a, C: Debug, T: Debug> Debug for Slice<'a, C, T> where
    C: Mix + Clone + 'a,
    T: AsRef<[(C::Scalar, C)]>,
    C::Scalar: Debug
[src]

Auto Trait Implementations

impl<'a, C, T> RefUnwindSafe for Slice<'a, C, T> where
    C: RefUnwindSafe,
    T: RefUnwindSafe,
    <C as Mix>::Scalar: RefUnwindSafe

impl<'a, C, T> Send for Slice<'a, C, T> where
    C: Sync,
    T: Sync,
    <C as Mix>::Scalar: Send

impl<'a, C, T> Sync for Slice<'a, C, T> where
    C: Sync,
    T: Sync,
    <C as Mix>::Scalar: Sync

impl<'a, C, T> Unpin for Slice<'a, C, T> where
    <C as Mix>::Scalar: Unpin

impl<'a, C, T> UnwindSafe for Slice<'a, C, T> where
    C: RefUnwindSafe,
    T: RefUnwindSafe,
    <C as Mix>::Scalar: UnwindSafe

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    T: FloatComponent,
    Swp: WhitePoint,
    Dwp: WhitePoint,
    D: AdaptFrom<S, Swp, Dwp, T>, 
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> IntoColor<U> for T where
    U: FromColor<T>, 
[src]

impl<T, U> IntoColorUnclamped<U> for T where
    U: FromColorUnclamped<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryIntoColor<U> for T where
    U: TryFromColor<T>, 
[src]