Skip to main content

GridCanvas

Enum GridCanvas 

Source
#[non_exhaustive]
pub enum GridCanvas { Ascii(AsciiCanvas), Block(BlockCanvas), Braille(BrailleCanvas), Density(DensityCanvas), Dot(DotCanvas), }
Expand description

A runtime-selected canvas backend for line, scatter, and density plots.

Wraps all five canvas types behind a single enum so that plots can select the canvas at runtime via CanvasType.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Trait Implementations§

Source§

impl Canvas for GridCanvas

Source§

fn pixel(&mut self, x: usize, y: usize, color: CanvasColor)

Sets a single pixel at the given pixel coordinates.
Source§

fn glyph_at(&self, col: usize, row: usize) -> char

Returns the Unicode glyph for the character cell at (col, row).
Source§

fn color_at(&self, col: usize, row: usize) -> CanvasColor

Returns the composited color for the character cell at (col, row).
Source§

fn char_width(&self) -> usize

The number of character columns in this canvas.
Source§

fn char_height(&self) -> usize

The number of character rows in this canvas.
Source§

fn pixel_width(&self) -> usize

The total pixel width (character columns times pixels per character).
Source§

fn pixel_height(&self) -> usize

The total pixel height (character rows times pixels per character).
Source§

fn transform(&self) -> &Transform2D

Returns a reference to this canvas’s coordinate transform.
Source§

fn transform_mut(&mut self) -> &mut Transform2D

Returns a mutable reference to this canvas’s coordinate transform.
Source§

fn point(&mut self, x: f64, y: f64, color: CanvasColor)

Plots a single data-space point, transforming it to pixel coordinates.
Source§

fn points(&mut self, xs: &[f64], ys: &[f64], color: CanvasColor)

Plots multiple data-space points. Silently ignores mismatched lengths.
Source§

fn line(&mut self, x1: f64, y1: f64, x2: f64, y2: f64, color: CanvasColor)

Draws a line between two data-space points using DDA rasterization.
Source§

fn lines(&mut self, xs: &[f64], ys: &[f64], color: CanvasColor)

Draws connected line segments through consecutive point pairs.
Source§

fn row_cells( &self, row: usize, ) -> impl Iterator<Item = (char, CanvasColor)> + '_

Iterates over (glyph, color) pairs for all cells in a character row.
Source§

impl Clone for GridCanvas

Source§

fn clone(&self) -> GridCanvas

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GridCanvas

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for GridCanvas

Source§

fn eq(&self, other: &GridCanvas) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for GridCanvas

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<C> GraphicsArea for C
where C: Canvas,

Source§

fn nrows(&self) -> usize

The number of character rows in the graphics area.
Source§

fn ncols(&self) -> usize

The number of character columns in the graphics area.
Source§

fn render_row(&self, row: usize, out: &mut Vec<RowCell>)

Fills out with the cells for the given row index.
Source§

fn blank_char(&self) -> char

The blank character used to fill empty cells (default: space).
Source§

fn prepare_render(&mut self)

Called before rendering begins. Override for pre-render setup.
Source§

fn finish_render(&mut self)

Called after rendering completes. Override for post-render cleanup.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.