Trait h3ron::Index

source ·
pub trait Index: Sized + PartialEq + FromH3Index {
    // Required methods
    fn h3index(&self) -> H3Index;
    fn new(h3index: H3Index) -> Self;
    fn validate(&self) -> Result<(), Error>;

    // Provided methods
    fn resolution(&self) -> u8 { ... }
    fn is_valid(&self) -> bool { ... }
    fn direction(&self) -> H3Direction { ... }
    fn direction_checked(&self) -> Result<H3Direction, Error> { ... }
    fn direction_to_parent_resolution(
        &self,
        target_resolution: u8
    ) -> Result<H3Direction, Error> { ... }
}
Expand description

Trait to handle types having a H3 Index like cells and edges

Required Methods§

source

fn h3index(&self) -> H3Index

Get the u64 H3 Index address

source

fn new(h3index: H3Index) -> Self

create an index from the given u64.

No validation is performed.

source

fn validate(&self) -> Result<(), Error>

Checks the validity of the index

Provided Methods§

source

fn resolution(&self) -> u8

Gets the index resolution (0-15)

source

fn is_valid(&self) -> bool

Checks the validity of the index

source

fn direction(&self) -> H3Direction

Retrieves the direction of the current index

Panics

May panic if self is invalid or has a resolution of 0

source

fn direction_checked(&self) -> Result<H3Direction, Error>

Retrieves the direction of the current index

Errors

May fail if self is invalid or has a resolution of 0

source

fn direction_to_parent_resolution( &self, target_resolution: u8 ) -> Result<H3Direction, Error>

Retrieves the direction of the current index relative to a parent at target_resolution

Object Safety§

This trait is not object safe.

Implementors§