Trait h3ron::Index [−][src]
pub trait Index: Sized + PartialEq { fn h3index(&self) -> H3Index; fn new(h3index: H3Index) -> Self; fn validate(&self) -> Result<(), Error>; fn resolution(&self) -> u8 { ... } fn is_valid(&self) -> bool { ... } fn is_parent_of(&self, other: &Self) -> bool { ... } fn is_child_of(&self, other: &Self) -> bool { ... } fn contains(&self, other: &Self) -> bool { ... } fn get_parent(&self, parent_resolution: u8) -> Result<Self, Error> { ... } fn get_parent_unchecked(&self, parent_resolution: u8) -> Self { ... } fn get_children(&self, child_resolution: u8) -> Vec<Self> { ... } }
Expand description
Trait to handle types having a H3 Index like cells and edges
Required methods
create an index from the given u64.
No validation is performed.
Provided methods
fn resolution(&self) -> u8
fn resolution(&self) -> u8
Gets the index resolution (0-15)
fn is_parent_of(&self, other: &Self) -> bool
fn is_parent_of(&self, other: &Self) -> bool
Checks if self
is a parent of other
fn is_child_of(&self, other: &Self) -> bool
fn is_child_of(&self, other: &Self) -> bool
Checks if other
is a parent of self
fn get_parent(&self, parent_resolution: u8) -> Result<Self, Error>
fn get_parent(&self, parent_resolution: u8) -> Result<Self, Error>
Retrieves the parent index at parent_resolution
.
Returns
This method may fail if the parent_resolution
is higher than current self
resolution.
If you don’t want it to fail use get_parent_unchecked
fn get_parent_unchecked(&self, parent_resolution: u8) -> Self
fn get_parent_unchecked(&self, parent_resolution: u8) -> Self
Retrieves the parent index at parent_resolution
.
Returns
This method may return an invalid Index
if the parent_resolution
is higher than current
self
resolution.
Use get_parent
for validity check.
fn get_children(&self, child_resolution: u8) -> Vec<Self>
fn get_children(&self, child_resolution: u8) -> Vec<Self>
Retrieves all children of self
at resolution child_resolution