pub struct TickGeneration { /* private fields */ }Expand description
One validated selection for generated numeric tick positions.
Targets allow nice-step deviation; maxima bound the complete in-domain list, including endpoint positions. Preferred intervals are tried before bounded coarser sources. Exact caller ticks take precedence over every selection.
use lichtung_plot::TickGeneration;
let linear = TickGeneration::additive(0.25)?;
let logarithmic = TickGeneration::log10_decades(2)?;
assert_eq!(linear.additive_step(), Some(0.25));
assert_eq!(logarithmic.decade_step(), Some(2));
assert_eq!(TickGeneration::target(5)?.target_count(), Some(5));
assert_eq!(TickGeneration::maximum(6)?.get_maximum_count(), Some(6));
assert!(TickGeneration::default().is_automatic());
assert!(TickGeneration::target(0).is_err());
assert!(TickGeneration::maximum(10_001).is_ok());The choice and payload are private:
let _ = lichtung_plot::TickGeneration::Target(0);Requests are owned and cloneable, not Copy:
use lichtung_plot::TickGeneration;
let request = TickGeneration::automatic();
let moved = request;
let _ = (moved, request);Implementations§
Source§impl TickGeneration
impl TickGeneration
Sourcepub fn function<F>(function: F) -> Self
pub fn function<F>(function: F) -> Self
Generate positions from the final domain and actual assigned span. Clones share the immutable callback; exact ticks suppress it entirely.
Sourcepub const fn is_automatic(&self) -> bool
pub const fn is_automatic(&self) -> bool
Inspect whether the complete request is Automatic without an explicit cap.
Sourcepub fn additive(step: f64) -> Result<Self>
pub fn additive(step: f64) -> Result<Self>
Prefer a finite strictly positive additive step on a linear numeric axis.
Sourcepub fn log10_decades(decades: u32) -> Result<Self>
pub fn log10_decades(decades: u32) -> Result<Self>
Prefer a nonzero integral exponent step on a base-ten logarithmic axis.
Sourcepub fn interval(
step: f64,
origin: f64,
space: TickSpace,
requirement: TickRequirement,
) -> Result<Self>
pub fn interval( step: f64, origin: f64, space: TickSpace, requirement: TickRequirement, ) -> Result<Self>
Select a finite positive interval and finite origin in the declared space.
Sourcepub const fn interval_parameters(
&self,
) -> Option<(f64, f64, TickSpace, TickRequirement)>
pub const fn interval_parameters( &self, ) -> Option<(f64, f64, TickSpace, TickRequirement)>
Inspect the retained step, origin, coordinate space and source requirement.
Sourcepub fn multiplicative(
anchor: f64,
ratio: f64,
requirement: TickRequirement,
) -> Result<Self>
pub fn multiplicative( anchor: f64, ratio: f64, requirement: TickRequirement, ) -> Result<Self>
Select the positive anchored geometric lattice, retaining either ratio direction.
Sourcepub const fn multiplicative_parameters(
&self,
) -> Option<(f64, f64, TickRequirement)>
pub const fn multiplicative_parameters( &self, ) -> Option<(f64, f64, TickRequirement)>
Inspect the supplied anchor, ratio direction and complete-source requirement.
Sourcepub fn target(count: usize) -> Result<Self>
pub fn target(count: usize) -> Result<Self>
Request approximately count numeric positions, allowing nice-step deviation.
Counts must be positive; one requests the original-domain midpoint. Actual label fit can select a coarser complete source.
Sourcepub fn maximum(count: usize) -> Result<Self>
pub fn maximum(count: usize) -> Result<Self>
Bound generated in-domain positions, including endpoints, by count.
Counts must be positive. The bound applies to complete generated sources, not exact caller ticks; it never drops individual labels.
Sourcepub const fn target_count(&self) -> Option<usize>
pub const fn target_count(&self) -> Option<usize>
Inspect the target count, or None for another selection.
Sourcepub const fn get_maximum_count(&self) -> Option<usize>
pub const fn get_maximum_count(&self) -> Option<usize>
Inspect the hard maximum count, or None for another selection.
Sourcepub fn maximum_count(self, maximum: Option<usize>) -> Result<Self>
pub fn maximum_count(self, maximum: Option<usize>) -> Result<Self>
Set or clear the positive generated cap, without replacing the locator.
Sourcepub const fn exact_count(count: usize, space: TickSpace) -> Self
pub const fn exact_count(count: usize, space: TickSpace) -> Self
Generate exactly count positions; zero is empty and one initially uses Lower.
Sourcepub fn singleton(self, position: TickSingleton) -> Result<Self>
pub fn singleton(self, position: TickSingleton) -> Result<Self>
Set exact-count singleton placement, retaining the complete request for n>=2.
Sourcepub const fn additive_step(&self) -> Option<f64>
pub const fn additive_step(&self) -> Option<f64>
Inspect the positive additive step, or None for another selection.
Sourcepub const fn decade_step(&self) -> Option<u32>
pub const fn decade_step(&self) -> Option<u32>
Inspect the positive integral decade step, or None for another selection.
Trait Implementations§
Source§impl Clone for TickGeneration
impl Clone for TickGeneration
Source§impl Debug for TickGeneration
impl Debug for TickGeneration
Source§impl Default for TickGeneration
impl Default for TickGeneration
impl Eq for TickGeneration
Source§impl PartialEq for TickGeneration
impl PartialEq for TickGeneration
impl StructuralPartialEq for TickGeneration
Auto Trait Implementations§
impl !RefUnwindSafe for TickGeneration
impl !UnwindSafe for TickGeneration
impl Forget for TickGeneration
impl Freeze for TickGeneration
impl Move for TickGeneration
impl Send for TickGeneration
impl Sync for TickGeneration
impl Unpin for TickGeneration
impl UnsafeUnpin for TickGeneration
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
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.