Struct h3ron::H3DirectedEdge
source · [−]#[repr(transparent)]pub struct H3DirectedEdge(_);
Expand description
H3 Index representing an directed H3 edge
Implementations
sourceimpl H3DirectedEdge
impl H3DirectedEdge
sourcepub fn from_cells(
origin_cell: H3Cell,
destination_cell: H3Cell
) -> Result<Self, Error>
pub fn from_cells(
origin_cell: H3Cell,
destination_cell: H3Cell
) -> Result<Self, Error>
Gets the unidirectional edge from origin_cell
to destination_cell
pub fn is_edge_valid(&self) -> bool
sourcepub fn edge_length_avg_km(resolution: u8) -> Result<f64, Error>
pub fn edge_length_avg_km(resolution: u8) -> Result<f64, Error>
Gets the average length of an edge in kilometers at resolution
.
This is the length of the cell boundary segment represented by the edge.
sourcepub fn edge_length_avg_m(resolution: u8) -> Result<f64, Error>
pub fn edge_length_avg_m(resolution: u8) -> Result<f64, Error>
Gets the average length of an edge in meters at resolution
.
This is the length of the cell boundary segment represented by the edge.
sourcepub fn cell_centroid_distance_avg_m_at_resolution(
resolution: u8
) -> Result<f64, Error>
pub fn cell_centroid_distance_avg_m_at_resolution(
resolution: u8
) -> Result<f64, Error>
The approximate distance between the centroids of two neighboring cells
at the given resolution
.
Based on the approximate edge length. See H3DirectedEdge::cell_centroid_distance_m
for a
more exact variant of this function.
sourcepub fn cell_centroid_distance_m(&self) -> Result<f64, Error>
pub fn cell_centroid_distance_m(&self) -> Result<f64, Error>
The approximate distance between the centroids of two neighboring cells
at the given resolution
.
Based on the exact edge length. See H3DirectedEdge::cell_centroid_distance_avg_m_at_resolution
for a resolution based variant.
sourcepub fn destination_cell(&self) -> Result<H3Cell, Error>
pub fn destination_cell(&self) -> Result<H3Cell, Error>
sourcepub fn origin_cell(&self) -> Result<H3Cell, Error>
pub fn origin_cell(&self) -> Result<H3Cell, Error>
sourcepub fn cells(&self) -> Result<H3EdgeCells, Error>
pub fn cells(&self) -> Result<H3EdgeCells, Error>
Retrieves a H3EdgeCells
of the origin and destination cell of the
edge.
Returns
If the built indexes are invalid, returns an Error.
sourcepub fn reversed(&self) -> Result<Self, Error>
pub fn reversed(&self) -> Result<Self, Error>
Retrieves the corresponding edge in the reversed direction.
Returns
If the built edge is invalid, returns an Error.
sourcepub fn boundary_linestring(&self) -> Result<LineString<f64>, Error>
pub fn boundary_linestring(&self) -> Result<LineString<f64>, Error>
Retrieves the LineString
which forms the boundary between
two cells.
sourcepub fn length_m(&self) -> Result<f64, Error>
pub fn length_m(&self) -> Result<f64, Error>
Retrieves the exact length of self
in meters
This is the length of the cell boundary segment represented by the edge.
sourcepub fn length_km(&self) -> Result<f64, Error>
pub fn length_km(&self) -> Result<f64, Error>
Retrieves the exact length of self
in kilometers
This is the length of the cell boundary segment represented by the edge.
sourcepub fn length_rads(&self) -> Result<f64, Error>
pub fn length_rads(&self) -> Result<f64, Error>
Retrieves the exact length of self
in radians
This is the length of the cell boundary segment represented by the edge.
Trait Implementations
sourceimpl Clone for H3DirectedEdge
impl Clone for H3DirectedEdge
sourcefn clone(&self) -> H3DirectedEdge
fn clone(&self) -> H3DirectedEdge
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for H3DirectedEdge
impl Debug for H3DirectedEdge
sourceimpl Deref for H3DirectedEdge
impl Deref for H3DirectedEdge
sourceimpl<'de> Deserialize<'de> for H3DirectedEdge
impl<'de> Deserialize<'de> for H3DirectedEdge
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl FromH3Index for H3DirectedEdge
impl FromH3Index for H3DirectedEdge
fn from_h3index(h3index: H3Index) -> Self
sourceimpl FromStr for H3DirectedEdge
impl FromStr for H3DirectedEdge
sourceimpl Hash for H3DirectedEdge
impl Hash for H3DirectedEdge
sourceimpl Index for H3DirectedEdge
impl Index for H3DirectedEdge
sourcefn resolution(&self) -> u8
fn resolution(&self) -> u8
Gets the index resolution (0-15)
sourcefn direction(&self) -> H3Direction
fn direction(&self) -> H3Direction
Retrieves the direction of the current index Read more
sourcefn direction_checked(&self) -> Result<H3Direction, Error>
fn direction_checked(&self) -> Result<H3Direction, Error>
Retrieves the direction of the current index Read more
sourcefn direction_to_parent_resolution(
&self,
target_resolution: u8
) -> Result<H3Direction, Error>
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
sourceimpl Ord for H3DirectedEdge
impl Ord for H3DirectedEdge
sourcefn cmp(&self, other: &H3DirectedEdge) -> Ordering
fn cmp(&self, other: &H3DirectedEdge) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<H3DirectedEdge> for H3DirectedEdge
impl PartialEq<H3DirectedEdge> for H3DirectedEdge
sourcefn eq(&self, other: &H3DirectedEdge) -> bool
fn eq(&self, other: &H3DirectedEdge) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl PartialOrd<H3DirectedEdge> for H3DirectedEdge
impl PartialOrd<H3DirectedEdge> for H3DirectedEdge
sourcefn partial_cmp(&self, other: &H3DirectedEdge) -> Option<Ordering>
fn partial_cmp(&self, other: &H3DirectedEdge) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Serialize for H3DirectedEdge
impl Serialize for H3DirectedEdge
sourceimpl ToLineString for H3DirectedEdge
impl ToLineString for H3DirectedEdge
sourcefn to_linestring(&self) -> Result<LineString<f64>, Self::Error>
fn to_linestring(&self) -> Result<LineString<f64>, Self::Error>
Create a linestring from the origin index to the destination index
use h3ron::{H3DirectedEdge, Index};
use h3ron::to_geo::{ToLineString, ToCoordinate};
let edge = H3DirectedEdge::new(0x149283080ddbffff);
let ls = edge.to_linestring().unwrap();
assert_eq!(ls.0.len(), 2);
assert_eq!(ls.0[0], edge.origin_cell().unwrap().to_coordinate().unwrap());
assert_eq!(ls.0[1], edge.destination_cell().unwrap().to_coordinate().unwrap());
type Error = Error
sourceimpl ToString for H3DirectedEdge
impl ToString for H3DirectedEdge
sourceimpl TryFrom<u64> for H3DirectedEdge
impl TryFrom<u64> for H3DirectedEdge
convert to index including validation
impl Copy for H3DirectedEdge
impl Eq for H3DirectedEdge
impl StructuralEq for H3DirectedEdge
impl StructuralPartialEq for H3DirectedEdge
Auto Trait Implementations
impl RefUnwindSafe for H3DirectedEdge
impl Send for H3DirectedEdge
impl Sync for H3DirectedEdge
impl Unpin for H3DirectedEdge
impl UnwindSafe for H3DirectedEdge
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more