[−][src]Struct plotters::prelude::Category
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 categoryelements
: 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
fn range(&self) -> Range<Category<T>>
[src]
fn map(&self, value: &Self::ValueType, limit: (i32, i32)) -> i32
[src]
fn key_points(&self, max_points: usize) -> Vec<Self::ValueType>
[src]
fn axis_pixel_range(&self, limit: (i32, i32)) -> Range<i32>
[src]
impl<T: PartialEq> AsRangedCoord for Category<T>
[src]
type CoordDescType = Self
type Value = Category<T>
impl<T: PartialEq> Clone for Category<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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,
T: RefUnwindSafe,
impl<T> !RefUnwindSafe for Category<T>
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
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]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
impl<T, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,