pub struct GuideStyle { /* private fields */ }Expand description
Closed visual style for a numeric guide line.
The pattern is selected through LinePattern; arbitrary backend dash
strings are not accepted.
use lichtung_plot::{Color, GuideStyle, LinePattern};
let guide = GuideStyle::new(Color::rgba(20, 80, 140, 128), 1.5, LinePattern::Solid)?
.pattern(LinePattern::Dashed)?;
assert_eq!(guide.get_color().get_alpha(), 128);Exact paint is typed; RGB tuples are not style inputs:
ⓘ
use lichtung_plot::{GuideStyle, LinePattern};
let _ = GuideStyle::new((20, 80, 140), 1.5, LinePattern::Solid);Implementations§
Source§impl GuideStyle
impl GuideStyle
Sourcepub fn new(
color: Color,
width: f32,
pattern: LinePattern,
) -> Result<Self, Error>
pub fn new( color: Color, width: f32, pattern: LinePattern, ) -> Result<Self, Error>
Construct a guide style with a complete RGBA paint, positive width, and closed line pattern.
§Errors
Returns an error when width is not finite and strictly positive.
Sourcepub const fn get_pattern(&self) -> LinePattern
pub const fn get_pattern(&self) -> LinePattern
Inspect the closed guide pattern.
Sourcepub fn color(self, color: Color) -> Result<Self, Error>
pub fn color(self, color: Color) -> Result<Self, Error>
Replace the complete exact guide paint.
Sourcepub fn width(self, width: f32) -> Result<Self, Error>
pub fn width(self, width: f32) -> Result<Self, Error>
Replace the positive guide width in CSS pixels.
Sourcepub fn pattern(self, pattern: LinePattern) -> Result<Self, Error>
pub fn pattern(self, pattern: LinePattern) -> Result<Self, Error>
Replace the closed guide pattern.
Trait Implementations§
Source§impl Clone for GuideStyle
impl Clone for GuideStyle
Source§impl Debug for GuideStyle
impl Debug for GuideStyle
Source§impl PartialEq for GuideStyle
impl PartialEq for GuideStyle
impl StructuralPartialEq for GuideStyle
Auto Trait Implementations§
impl Forget for GuideStyle
impl Freeze for GuideStyle
impl Move for GuideStyle
impl RefUnwindSafe for GuideStyle
impl Send for GuideStyle
impl Sync for GuideStyle
impl Unpin for GuideStyle
impl UnsafeUnpin for GuideStyle
impl UnwindSafe for GuideStyle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.