pub struct SignificanceMarkStyle { /* private fields */ }Expand description
Independent typography and clearance for exact significance marks.
An explicit default is 16 CSS pixels, Normal weight and an 8px gap. Omitting the style lets the owning theme supply those properties instead.
use lichtung_plot::{elements::SignificanceMarkStyle, text::TextWeight};
let style = SignificanceMarkStyle::default()
.font_size(18.0)?.weight(TextWeight::Semibold)?.gap(9.0)?;
assert_eq!(style.get_font_size(), 18.0);
assert_eq!(style.get_weight(), TextWeight::Semibold);
assert_eq!(style.get_gap(), 9.0);Private fields prevent bypassing complete construction validation:
ⓘ
use lichtung_plot::elements::SignificanceMarkStyle;
let mut style = SignificanceMarkStyle::default();
style.gap = f64::NAN;Implementations§
Source§impl SignificanceMarkStyle
impl SignificanceMarkStyle
Sourcepub fn new(
font_size: f64,
weight: TextWeight,
gap: f64,
) -> Result<SignificanceMarkStyle, Error>
pub fn new( font_size: f64, weight: TextWeight, gap: f64, ) -> Result<SignificanceMarkStyle, Error>
Construct a validated mark style.
Sourcepub fn font_size(self, font_size: f64) -> Result<SignificanceMarkStyle, Error>
pub fn font_size(self, font_size: f64) -> Result<SignificanceMarkStyle, Error>
Replace the positive mark font size in CSS pixels.
Sourcepub fn weight(self, weight: TextWeight) -> Result<SignificanceMarkStyle, Error>
pub fn weight(self, weight: TextWeight) -> Result<SignificanceMarkStyle, Error>
Replace the mark font weight.
Sourcepub fn gap(self, gap: f64) -> Result<SignificanceMarkStyle, Error>
pub fn gap(self, gap: f64) -> Result<SignificanceMarkStyle, Error>
Replace the finite nonnegative mark-to-data gap in CSS pixels.
Sourcepub const fn get_font_size(&self) -> f64
pub const fn get_font_size(&self) -> f64
Inspect the exact positive font size in CSS pixels.
Sourcepub const fn get_weight(&self) -> TextWeight
pub const fn get_weight(&self) -> TextWeight
Inspect the exact font weight.
Trait Implementations§
Source§impl Clone for SignificanceMarkStyle
impl Clone for SignificanceMarkStyle
Source§fn clone(&self) -> SignificanceMarkStyle
fn clone(&self) -> SignificanceMarkStyle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SignificanceMarkStyle
Source§impl Debug for SignificanceMarkStyle
impl Debug for SignificanceMarkStyle
Source§impl Default for SignificanceMarkStyle
impl Default for SignificanceMarkStyle
Source§fn default() -> SignificanceMarkStyle
fn default() -> SignificanceMarkStyle
Returns the “default value” for a type. Read more
Source§impl PartialEq for SignificanceMarkStyle
impl PartialEq for SignificanceMarkStyle
impl StructuralPartialEq for SignificanceMarkStyle
Auto Trait Implementations§
impl Forget for SignificanceMarkStyle
impl Freeze for SignificanceMarkStyle
impl Move for SignificanceMarkStyle
impl RefUnwindSafe for SignificanceMarkStyle
impl Send for SignificanceMarkStyle
impl Sync for SignificanceMarkStyle
impl Unpin for SignificanceMarkStyle
impl UnsafeUnpin for SignificanceMarkStyle
impl UnwindSafe for SignificanceMarkStyle
Blanket Implementations§
impl<T> Allocation for T
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.