pub trait PointCollection<'a, Coord, CM = BackendCoordOnly> {
    type Point: Borrow<Coord> + 'a;
    type IntoIter: IntoIterator<Item = Self::Point>;

    // Required method
    fn point_iter(self) -> Self::IntoIter;
}
Expand description

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.

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.

Required Associated Types§

source

type Point: Borrow<Coord> + 'a

The item in point iterator

source

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

The point iterator

Required Methods§

source

fn point_iter(self) -> Self::IntoIter

framework to do the coordinate mapping

Implementors§

source§

impl<'a, 'b, Coord> PointCollection<'a, Coord, BackendCoordOnly> for &'a BitMapElement<'b, Coord>

source§

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

§

type Point = &'a Coord

§

type IntoIter = &'a Vec<Coord, Global>

source§

impl<'a, Coord> PointCollection<'a, Coord, BackendCoordOnly> for &'a PathElement<Coord>

source§

impl<'a, Coord> PointCollection<'a, Coord, BackendCoordOnly> for &'a Pixel<Coord>

source§

impl<'a, Coord> PointCollection<'a, Coord, BackendCoordOnly> for &'a Polygon<Coord>

source§

impl<'a, Coord> PointCollection<'a, Coord, BackendCoordOnly> for &'a Rectangle<Coord>

source§

impl<'a, Coord, DB: DrawingBackend> PointCollection<'a, Coord, BackendCoordOnly> for &'a EmptyElement<Coord, DB>

source§

impl<'a, Coord, Size: SizeDesc> PointCollection<'a, Coord, BackendCoordOnly> for &'a Circle<Coord, Size>

source§

impl<'a, Coord: 'a, Size: SizeDesc> PointCollection<'a, Coord, BackendCoordOnly> for &'a Cross<Coord, Size>

source§

impl<'a, Coord: 'a, Size: SizeDesc> PointCollection<'a, Coord, BackendCoordOnly> for &'a TriangleMarker<Coord, Size>

source§

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

§

type Point = (<O as BoxplotOrient<K, f32>>::XType, <O as BoxplotOrient<K, f32>>::YType)

§

type IntoIter = Vec<<&'a Boxplot<K, O> as PointCollection<'a, (<O as BoxplotOrient<K, f32>>::XType, <O as BoxplotOrient<K, f32>>::YType), BackendCoordOnly>>::Point, Global>

source§

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

§

type Point = (<O as ErrorBarOrient<K, V>>::XType, <O as ErrorBarOrient<K, V>>::YType)

§

type IntoIter = Vec<<&'a ErrorBar<K, V, O> as PointCollection<'a, (<O as ErrorBarOrient<K, V>>::XType, <O as ErrorBarOrient<K, V>>::YType), BackendCoordOnly>>::Point, Global>

source§

impl<'a, Label: Display> PointCollection<'a, (i32, i32), BackendCoordOnly> for &'a Pie<'a, (i32, i32), Label>

§

type Point = &'a (i32, i32)

§

type IntoIter = Once<&'a (i32, i32)>

source§

impl<'a, X: 'a, Y: 'a, Z: 'a> PointCollection<'a, (X, Y, Z), BackendCoordAndZ> for &'a Cubiod<X, Y, Z>

§

type Point = &'a (X, Y, Z)

§

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

source§

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

§

type Point = &'a (X, Y)

§

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

source§

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

source§

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

source§

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