[][src]Trait plotters_unstable::element::PointCollection

pub trait PointCollection<'a, Coord> {
    type Point: Borrow<Coord> + 'a;
    type IntoIter: IntoIterator<Item = Self::Point>;
    fn point_iter(self) -> Self::IntoIter;
}

A type which is logically a collection of points, under any given coordinate system. Note: Ideally, a point collection trait should be any type of which coordinate elements can be iterated. This is similar to iter method of many collection types in std.

This example is not tested
trait PointCollection<Coord> {
    type PointIter<'a> : Iterator<Item = &'a Coord>;
    fn iter(&self) -> PointIter<'a>;
}

However, Generic Associated Types is far away from stablize. So currently we have the following workaround:

Instead of implement the PointCollection trait on the element type itself, it implements on the reference to the element. By doing so, we now have a well-defined lifetime for the iterator.

In addition, for some element, the coordinate is computed on the fly, thus we can't hard-code the iterator's return type is &'a Coord. Borrow trait seems to strict in this case, since we don't need the order and hash preservation properties at this point. However, AsRef doesn't work with Coord

This workaround also leads overly strict lifetime bound on ChartContext::draw_series.

TODO: Once GAT is ready on stable Rust, we should simplify the design.

Associated Types

type Point: Borrow<Coord> + 'a

The item in point iterator

type IntoIter: IntoIterator<Item = Self::Point>

The point iterator

Loading content...

Required methods

fn point_iter(self) -> Self::IntoIter

framework to do the coordinate mapping

Loading content...

Implementors

impl<'a, 'b, Coord> PointCollection<'a, Coord> for &'a BitMapElement<'b, Coord>[src]

type Point = &'a Coord

type IntoIter = Once<&'a Coord>

impl<'a, 'b: 'a, DB: DrawingBackend, Coord: Clone> PointCollection<'a, Coord> for &'a DynElement<'b, DB, Coord>[src]

type Point = &'a Coord

type IntoIter = &'a Vec<Coord>

impl<'a, Coord> PointCollection<'a, Coord> for &'a PathElement<Coord>[src]

impl<'a, Coord> PointCollection<'a, Coord> for &'a Pixel<Coord>[src]

type Point = &'a Coord

type IntoIter = Once<&'a Coord>

impl<'a, Coord> PointCollection<'a, Coord> for &'a Polygon<Coord>[src]

impl<'a, Coord> PointCollection<'a, Coord> for &'a Rectangle<Coord>[src]

impl<'a, Coord, DB: DrawingBackend> PointCollection<'a, Coord> for &'a EmptyElement<Coord, DB>[src]

type Point = &'a Coord

type IntoIter = Once<&'a Coord>

impl<'a, Coord, Size: SizeDesc> PointCollection<'a, Coord> for &'a Circle<Coord, Size>[src]

type Point = &'a Coord

type IntoIter = Once<&'a Coord>

impl<'a, Coord: 'a, Size: SizeDesc> PointCollection<'a, Coord> for &'a Cross<Coord, Size>[src]

type Point = &'a Coord

type IntoIter = Once<&'a Coord>

impl<'a, Coord: 'a, Size: SizeDesc> PointCollection<'a, Coord> for &'a TriangleMarker<Coord, Size>[src]

type Point = &'a Coord

type IntoIter = Once<&'a Coord>

impl<'a, K: Clone, O: BoxplotOrient<K, f32>> PointCollection<'a, (<O as BoxplotOrient<K, f32>>::XType, <O as BoxplotOrient<K, f32>>::YType)> for &'a Boxplot<K, O>[src]

type Point = (O::XType, O::YType)

type IntoIter = Vec<Self::Point>

impl<'a, K: Clone, V: Clone, O: ErrorBarOrient<K, V>> PointCollection<'a, (<O as ErrorBarOrient<K, V>>::XType, <O as ErrorBarOrient<K, V>>::YType)> for &'a ErrorBar<K, V, O>[src]

type Point = (O::XType, O::YType)

type IntoIter = Vec<Self::Point>

impl<'a, X: 'a, Y: PartialOrd + 'a> PointCollection<'a, (X, Y)> for &'a CandleStick<X, Y>[src]

type Point = &'a (X, Y)

type IntoIter = &'a [(X, Y)]

impl<'b, 'a, Coord: 'a, T: Borrow<str> + 'a> PointCollection<'a, Coord> for &'a MultiLineText<'b, Coord, T>[src]

type Point = &'a Coord

type IntoIter = Once<&'a Coord>

impl<'b, 'a, Coord: 'a, T: Borrow<str> + 'a> PointCollection<'a, Coord> for &'a Text<'b, Coord, T>[src]

type Point = &'a Coord

type IntoIter = Once<&'a Coord>

impl<'b, Coord, DB: DrawingBackend, A, B> PointCollection<'b, Coord> for &'b ComposedElement<Coord, DB, A, B> where
    A: Drawable<DB>,
    B: Drawable<DB>, 
[src]

type Point = &'b Coord

type IntoIter = Once<&'b Coord>

Loading content...