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
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl 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>,
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
sourcefn direction(&self) -> H3Direction
fn direction(&self) -> H3Direction
sourcefn direction_checked(&self) -> Result<H3Direction, Error>
fn direction_checked(&self) -> Result<H3Direction, Error>
sourcefn direction_to_parent_resolution(
&self,
target_resolution: u8
) -> Result<H3Direction, Error>
fn direction_to_parent_resolution(
&self,
target_resolution: u8
) -> Result<H3Direction, Error>
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 · sourceconst fn max(self, other: Self) -> Selfwhere
Self: Sized,
const fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourceconst fn min(self, other: Self) -> Selfwhere
Self: Sized,
const fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl PartialEq<H3DirectedEdge> for H3DirectedEdge
impl PartialEq<H3DirectedEdge> for H3DirectedEdge
sourcefn eq(&self, other: &H3DirectedEdge) -> bool
fn eq(&self, other: &H3DirectedEdge) -> bool
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>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresourceimpl Serialize for H3DirectedEdge
impl Serialize for H3DirectedEdge
sourceimpl ToLine for H3DirectedEdge
impl ToLine for H3DirectedEdge
sourcefn to_line(&self) -> Result<Line<f64>, Self::Error>
fn to_line(&self) -> Result<Line<f64>, Self::Error>
Create a line geometry from the origin index to the destination index
use h3ron::{H3DirectedEdge, Index};
use h3ron::to_geo::{ToLine, ToCoordinate};
let edge = H3DirectedEdge::new(0x149283080ddbffff);
let l = edge.to_line().unwrap();
assert_eq!(l.start, edge.origin_cell().unwrap().to_coordinate().unwrap());
assert_eq!(l.end, edge.destination_cell().unwrap().to_coordinate().unwrap());
type Error = Error
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> CallHasher for Twhere
T: Hash + ?Sized,
impl<T> CallHasher for Twhere
T: Hash + ?Sized,
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.