[][src]Struct plotters::prelude::Category

pub struct Category<T: PartialEq> { /* fields omitted */ }

The category coordinate

Methods

impl<T: PartialEq> Category<T>[src]

pub fn new<S: Into<String>>(name: S, elements: Vec<T>) -> Self[src]

Create a new category coordinate.

  • name: The name of the category
  • elements: The vector of category elements
  • returns The newly created category coordinate
use plotters::prelude::*;

let category = Category::new("color", vec!["red", "green", "blue"]);

pub fn get(&self, val: &T) -> Option<Category<T>>[src]

Get an element reference (tick) by its value.

  • val: The value of the element
  • returns The optional reference
use plotters::prelude::*;

let category = Category::new("color", vec!["red", "green", "blue"]);
let red = category.get(&"red");
assert!(red.is_some());
let unknown = category.get(&"unknown");
assert!(unknown.is_none());

pub fn range(&self) -> Self[src]

Create a full range over the category elements.

  • returns The range including all category elements
use plotters::prelude::*;

let category = Category::new("color", vec!["red", "green", "blue"]);
let range = category.range();

pub fn len(&self) -> usize[src]

Get the number of elements in the category.

  • returns The number of elements
use plotters::prelude::*;

let category = Category::new("color", vec!["red", "green", "blue"]);
assert_eq!(category.len(), 3);

pub fn is_empty(&self) -> bool[src]

Returns true if the category contains no elements.

  • returns true is no elements, otherwise - false
use plotters::prelude::*;

let category = Category::new("color", vec!["red", "green", "blue"]);
assert_eq!(category.is_empty(), false);

let category = Category::new("empty", Vec::<&str>::new());
assert_eq!(category.is_empty(), true);

pub fn name(&self) -> String[src]

Get the category name.

  • returns The name of the category
use plotters::prelude::*;

let category = Category::new("color", vec!["red", "green", "blue"]);
assert_eq!(category.name(), "color");

Trait Implementations

impl<T: PartialEq> Ranged for Category<T>[src]

type ValueType = Category<T>

The type of this value

impl<T: PartialEq> AsRangedCoord for Category<T>[src]

type CoordDescType = Self

type Value = Category<T>

impl<T: PartialEq> Clone for Category<T>[src]

impl<T: PartialEq + Display> Debug for Category<T>[src]

Auto Trait Implementations

impl<T> !Send for Category<T>

impl<T> Unpin for Category<T>

impl<T> !Sync for Category<T>

impl<T> UnwindSafe for Category<T> where
    T: RefUnwindSafe

impl<T> !RefUnwindSafe for Category<T>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SetParameter for T

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

impl<T, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]