pub struct AxisBounds { /* private fields */ }Expand description
The [min, max] range of one axis, in the plot’s f64 coordinate space.
The units are those of the source GraphData, which the adapter is generic
over: for a payoff (#27) the x range is the underlying price and the y range is
P&L; for a vol smile (#47) x is the strike and y is implied volatility; for a
Greek curve x is the strike and y is the selected Greek. The adapter carries the
numeric range only — the semantic axis title is supplied by the screen.
§Invariant
Both endpoints are finite and ordered (min <= max) by construction: the
fields are private and new is the only constructor, rejecting any
NaN/Inf or inverted range before it can reach a ratatui axis. Read them
through min / max / to_array.
§Degenerate intervals are padded at the seam
A single-point or flat series would otherwise yield min == max — a zero-width
range ratatui’s chart rejects entirely, painting a BLANK chart. The projection
pads such an interval (the internal padded step), so the axis always has real
width and a flat line stays visible; the pad size is documented on that step.
Implementations§
Source§impl AxisBounds
impl AxisBounds
Sourcepub fn new(min: f64, max: f64) -> Option<Self>
pub fn new(min: f64, max: f64) -> Option<Self>
Construct validated bounds, or None when the “finite, ordered” invariant
fails: both min and max must be finite (no NaN/Inf) and ordered
(min <= max). This is the ONLY way to build an AxisBounds, so a
downstream caller can never hand a non-finite or inverted range to a ratatui
axis. A degenerate min == max is accepted here (it is finite and ordered);
the projection expands it via the internal padded step.
Sourcepub fn to_array(self) -> [f64; 2]
pub fn to_array(self) -> [f64; 2]
The bounds as the [f64; 2] array Axis::bounds
consumes.
Trait Implementations§
Source§impl Clone for AxisBounds
impl Clone for AxisBounds
Source§fn clone(&self) -> AxisBounds
fn clone(&self) -> AxisBounds
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AxisBounds
Source§impl Debug for AxisBounds
impl Debug for AxisBounds
Source§impl PartialEq for AxisBounds
impl PartialEq for AxisBounds
impl StructuralPartialEq for AxisBounds
Auto Trait Implementations§
impl Freeze for AxisBounds
impl RefUnwindSafe for AxisBounds
impl Send for AxisBounds
impl Sync for AxisBounds
impl Unpin for AxisBounds
impl UnsafeUnpin for AxisBounds
impl UnwindSafe for AxisBounds
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
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
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.