[][src]Trait eyros::Point

pub trait Point: Copy + Clone + Send + Sync + Debug + ToBytes + FromBytes + CountBytes {
    type Bounds: Copy + Clone + Send + Sync + Debug + ToBytes + FromBytes + CountBytes;
    type Range: Point + Copy + Clone + Send + Sync + Debug + ToBytes + FromBytes + CountBytes;
    fn cmp_at(&self, other: &Self, level: usize) -> Ordering
    where
        Self: Sized
;
fn midpoint_upper(&self, other: &Self) -> Self
    where
        Self: Sized
;
fn serialize_at(&self, level: usize, dst: &mut [u8]) -> Result<usize, Error>;
fn dim() -> usize;
fn overlaps(&self, bbox: &Self::Bounds) -> bool;
fn pivot_bytes_at(&self, level: usize) -> usize;
fn count_bytes_at(buf: &[u8], level: usize) -> Result<usize, Error>;
fn query_branch(
        buf: &[u8],
        bbox: &Self::Bounds,
        branch_factor: usize,
        level: usize
    ) -> Result<(Vec<Cursor>, Vec<Block>), Error>;
fn bounds(coords: &Vec<Self>) -> Option<Self::Bounds>;
fn bounds_to_range(bbox: Self::Bounds) -> Self::Range;
fn format_at(buf: &[u8], level: usize) -> Result<String, Error>; }

Points (scalar or interval) must implement these methods. There's a lot going on here, so you'll most likely want to use one of the built-in implementations rather than write your own.

Below, the term "element" refs to a value contained in a point which could be a scalar or interval. For example, for the point ((-2.0,4.5), 6.0, (9.0,11.0)), each of (-2.0,4.5), 6.0, and (9.0,11.0) is an "element".

Presently only types with static sizes are supported.

Associated Types

type Bounds: Copy + Clone + Send + Sync + Debug + ToBytes + FromBytes + CountBytes

Bounding-box corresponding to (min,max) as used by db.query(bbox).

type Range: Point + Copy + Clone + Send + Sync + Debug + ToBytes + FromBytes + CountBytes

Range corresponding to ((minX,maxX),(minY,maxY),...)

Loading content...

Required methods

fn cmp_at(&self, other: &Self, level: usize) -> Ordering where
    Self: Sized

Compare elements at a level of tree depth. The dimension under consideration alternates each level, so you'll likely want the element at an index corresponding to level % dimension.

fn midpoint_upper(&self, other: &Self) -> Self where
    Self: Sized

For intervals, calculate the midpoint of the greater (upper) interval bound (ex: iv.1) for two intervals, returning a new interval where both elements are the midpoint result. For scalars, return the midpoint of two scalars as a scalar.

fn serialize_at(&self, level: usize, dst: &mut [u8]) -> Result<usize, Error>

Return the byte presentation for the element corresponding to the tree depth level for the purpose of making a pivot. If you have an interval type, return the upper bound.

fn dim() -> usize

Get the number of dimensions for this point type.

fn overlaps(&self, bbox: &Self::Bounds) -> bool

Return whether the current point intersects with a bounding box.

fn pivot_bytes_at(&self, level: usize) -> usize

Return the size in bytes of the pivot-form of the element corresponding to the tree depth level.

fn count_bytes_at(buf: &[u8], level: usize) -> Result<usize, Error>

Calculate the number of bytes to read from buf for the tree depth level.

fn query_branch(
    buf: &[u8],
    bbox: &Self::Bounds,
    branch_factor: usize,
    level: usize
) -> Result<(Vec<Cursor>, Vec<Block>), Error>

Return a set of (branch_offset,tree_depth) tuples (Cursors) for sub-branches to load next and a set of u64 (Blocks) to read data from according to a traversal of the branch data in buf at the tree depth level and subject to the bounds given in bbox.

fn bounds(coords: &Vec<Self>) -> Option<Self::Bounds>

Return a bounding box for a set of coordinates, if possible.

fn bounds_to_range(bbox: Self::Bounds) -> Self::Range

Return a Range corresponding to a bounding box. This involves transposing the items. For example:

((-1.0,0.0,-4.0),(3.0,0.8,2.5) (bbox)

becomes

((-1.0,3.0),(0.0,0.8),(-4.0,2.5)) (range)

fn format_at(buf: &[u8], level: usize) -> Result<String, Error>

Return a string representation of the element in a buffer slice corresponding to the tree depth level.

Loading content...

Implementations on Foreign Types

impl<A, B> Point for (A, B) where
    A: Num<A>,
    B: Num<B>, 
[src]

type Bounds = ((A, B), (A, B))

type Range = ((A, A), (B, B))

impl<A, B> Point for (A, (B, B)) where
    A: Num<A>,
    B: Num<B>, 
[src]

type Bounds = ((A, B), (A, B))

type Range = ((A, A), (B, B))

impl<A, B> Point for ((A, A), B) where
    A: Num<A>,
    B: Num<B>, 
[src]

type Bounds = ((A, B), (A, B))

type Range = ((A, A), (B, B))

impl<A, B> Point for ((A, A), (B, B)) where
    A: Num<A>,
    B: Num<B>, 
[src]

type Bounds = ((A, B), (A, B))

type Range = ((A, A), (B, B))

impl<A, B, C> Point for (A, B, C) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>, 
[src]

type Bounds = ((A, B, C), (A, B, C))

type Range = ((A, A), (B, B), (C, C))

impl<A, B, C> Point for (A, B, (C, C)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>, 
[src]

type Bounds = ((A, B, C), (A, B, C))

type Range = ((A, A), (B, B), (C, C))

impl<A, B, C> Point for (A, (B, B), C) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>, 
[src]

type Bounds = ((A, B, C), (A, B, C))

type Range = ((A, A), (B, B), (C, C))

impl<A, B, C> Point for (A, (B, B), (C, C)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>, 
[src]

type Bounds = ((A, B, C), (A, B, C))

type Range = ((A, A), (B, B), (C, C))

impl<A, B, C> Point for ((A, A), B, C) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>, 
[src]

type Bounds = ((A, B, C), (A, B, C))

type Range = ((A, A), (B, B), (C, C))

impl<A, B, C> Point for ((A, A), B, (C, C)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>, 
[src]

type Bounds = ((A, B, C), (A, B, C))

type Range = ((A, A), (B, B), (C, C))

impl<A, B, C> Point for ((A, A), (B, B), C) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>, 
[src]

type Bounds = ((A, B, C), (A, B, C))

type Range = ((A, A), (B, B), (C, C))

impl<A, B, C> Point for ((A, A), (B, B), (C, C)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>, 
[src]

type Bounds = ((A, B, C), (A, B, C))

type Range = ((A, A), (B, B), (C, C))

impl<A, B, C, D> Point for (A, B, C, D) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for (A, B, C, (D, D)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for (A, B, (C, C), D) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for (A, B, (C, C), (D, D)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for (A, (B, B), C, D) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for (A, (B, B), C, (D, D)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for (A, (B, B), (C, C), D) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for (A, (B, B), (C, C), (D, D)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for ((A, A), B, C, D) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for ((A, A), B, C, (D, D)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for ((A, A), B, (C, C), D) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for ((A, A), B, (C, C), (D, D)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for ((A, A), (B, B), C, D) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for ((A, A), (B, B), C, (D, D)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for ((A, A), (B, B), (C, C), D) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D> Point for ((A, A), (B, B), (C, C), (D, D)) where
    A: Num<A>,
    B: Num<B>,
    C: Num<C>,
    D: Num<D>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

Loading content...

Implementors

impl<A, B> Point for Mix2<A, B> where
    ((A, A), (B, B)): Point,
    A: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = A> + Div<Output = A> + From<u8>,
    B: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = B> + Div<Output = B> + From<u8>, 
[src]

type Bounds = ((A, B), (A, B))

type Range = ((A, A), (B, B))

impl<A, B, C> Point for Mix3<A, B, C> where
    ((A, A), (B, B), (C, C)): Point,
    A: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = A> + Div<Output = A> + From<u8>,
    B: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = B> + Div<Output = B> + From<u8>,
    C: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = C> + Div<Output = C> + From<u8>, 
[src]

type Bounds = ((A, B, C), (A, B, C))

type Range = ((A, A), (B, B), (C, C))

impl<A, B, C, D> Point for Mix4<A, B, C, D> where
    ((A, A), (B, B), (C, C), (D, D)): Point,
    A: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = A> + Div<Output = A> + From<u8>,
    B: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = B> + Div<Output = B> + From<u8>,
    C: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = C> + Div<Output = C> + From<u8>,
    D: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = D> + Div<Output = D> + From<u8>, 
[src]

type Bounds = ((A, B, C, D), (A, B, C, D))

type Range = ((A, A), (B, B), (C, C), (D, D))

impl<A, B, C, D, E> Point for Mix5<A, B, C, D, E> where
    ((A, A), (B, B), (C, C), (D, D), (E, E)): Point,
    A: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = A> + Div<Output = A> + From<u8>,
    B: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = B> + Div<Output = B> + From<u8>,
    C: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = C> + Div<Output = C> + From<u8>,
    D: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = D> + Div<Output = D> + From<u8>,
    E: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = E> + Div<Output = E> + From<u8>, 
[src]

type Bounds = ((A, B, C, D, E), (A, B, C, D, E))

type Range = ((A, A), (B, B), (C, C), (D, D), (E, E))

impl<A, B, C, D, E, F> Point for Mix6<A, B, C, D, E, F> where
    ((A, A), (B, B), (C, C), (D, D), (E, E), (F, F)): Point,
    A: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = A> + Div<Output = A> + From<u8>,
    B: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = B> + Div<Output = B> + From<u8>,
    C: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = C> + Div<Output = C> + From<u8>,
    D: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = D> + Div<Output = D> + From<u8>,
    E: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = E> + Div<Output = E> + From<u8>,
    F: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = F> + Div<Output = F> + From<u8>, 
[src]

type Bounds = ((A, B, C, D, E, F), (A, B, C, D, E, F))

type Range = ((A, A), (B, B), (C, C), (D, D), (E, E), (F, F))

impl<A, B, C, D, E, F, G> Point for Mix7<A, B, C, D, E, F, G> where
    ((A, A), (B, B), (C, C), (D, D), (E, E), (F, F), (G, G)): Point,
    A: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = A> + Div<Output = A> + From<u8>,
    B: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = B> + Div<Output = B> + From<u8>,
    C: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = C> + Div<Output = C> + From<u8>,
    D: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = D> + Div<Output = D> + From<u8>,
    E: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = E> + Div<Output = E> + From<u8>,
    F: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = F> + Div<Output = F> + From<u8>,
    G: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = G> + Div<Output = G> + From<u8>, 
[src]

type Bounds = ((A, B, C, D, E, F, G), (A, B, C, D, E, F, G))

type Range = ((A, A), (B, B), (C, C), (D, D), (E, E), (F, F), (G, G))

impl<A, B, C, D, E, F, G, H> Point for Mix8<A, B, C, D, E, F, G, H> where
    ((A, A), (B, B), (C, C), (D, D), (E, E), (F, F), (G, G), (H, H)): Point,
    A: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = A> + Div<Output = A> + From<u8>,
    B: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = B> + Div<Output = B> + From<u8>,
    C: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = C> + Div<Output = C> + From<u8>,
    D: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = D> + Div<Output = D> + From<u8>,
    E: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = E> + Div<Output = E> + From<u8>,
    F: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = F> + Div<Output = F> + From<u8>,
    G: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = G> + Div<Output = G> + From<u8>,
    H: ToBytes + FromBytes + CountBytes + Copy + Send + Sync + Debug + PartialOrd + Add<Output = H> + Div<Output = H> + From<u8>, 
[src]

type Bounds = ((A, B, C, D, E, F, G, H), (A, B, C, D, E, F, G, H))

type Range = ((A, A), (B, B), (C, C), (D, D), (E, E), (F, F), (G, G), (H, H))

Loading content...