pub struct Domain(pub Range<f64>);Expand description
Tuple Fields§
§0: Range<f64>Implementations§
Source§impl Domain
impl Domain
Sourcepub fn min(&self) -> f64
pub fn min(&self) -> f64
The smallest value of the domain.
§Examples
use termplot::Domain;
let domain = Domain(-10.0..10.0);
assert_eq!(domain.min(), -10.0);Sourcepub fn max(&self) -> f64
pub fn max(&self) -> f64
The largest value of the domain.
§Examples
use termplot::Domain;
let domain = Domain(-10.0..10.0);
assert_eq!(domain.max(), 10.0);Sourcepub fn range(&self) -> f64
pub fn range(&self) -> f64
The range of the domain as an absolute value.
§Examples
use termplot::Domain;
let domain = Domain(-10.0..10.0);
assert_eq!(domain.range(), 20.0);
let domain = Domain(8.0..-8.0);
assert_eq!(domain.range(), 16.0);Sourcepub fn iter(&self, steps: usize) -> DomainIterator ⓘ
pub fn iter(&self, steps: usize) -> DomainIterator ⓘ
An iterator over the range where a number of steps.
For example, use this if it’s needed to compute the value of each pixel for a plot.
§Examples
use termplot::{Domain};
let domain = Domain(-10.0..10.0);
let view_width = 100;
domain
.iter(view_width)
.for_each(|x| {
// draw into the canvas
});See how plot::Graph is implemented for an in depth example.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Domain
impl RefUnwindSafe for Domain
impl Send for Domain
impl Sync for Domain
impl Unpin for Domain
impl UnwindSafe for Domain
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