pub struct ColorRule {
pub map: Colormap,
pub range: (f32, f32),
pub below: OutOfRange,
pub above: OutOfRange,
pub center: Option<f32>,
pub base: [u8; 4],
pub nan: [u8; 4],
}Expand description
How a scalar field is turned into colours.
Fields§
§map: ColormapThe colormap.
range: (f32, f32)(lo, hi): values mapped onto the colormap; lo < hi, both finite.
below: OutOfRangeColour rule for values below lo (and -∞).
above: OutOfRangeColour rule for values above hi (and +∞).
center: Option<f32>A value pinned to the middle of the colormap, within range.
base: [u8; 4]The colour of OutOfRange::Base.
nan: [u8; 4]The colour of NaN values.
Implementations§
Source§impl ColorRule
impl ColorRule
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Checks the rule.
§Errors
FieldsError::InvalidInput if range has a non-finite end or
lo >= hi, if center is non-finite or outside range, or if a
custom colormap has fewer than two stops or stop positions that are
not finite, outside [0, 1] or not strictly increasing.
Trait Implementations§
impl StructuralPartialEq for ColorRule
Auto Trait Implementations§
impl Freeze for ColorRule
impl RefUnwindSafe for ColorRule
impl Send for ColorRule
impl Sync for ColorRule
impl Unpin for ColorRule
impl UnsafeUnpin for ColorRule
impl UnwindSafe for ColorRule
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