pub struct DirectedEdgeIndex(/* private fields */);Expand description
Represents a single directed edge between two cells (an “origin” cell and a neighboring “destination” cell).
The index is encoded on 64-bit with the following bit layout:
┏━┳━━━┳━━━┳━━━━━━━━━━━━━━━━━━━━━━┈┈┈┈┈┈┈┈━━━━━━━┓
┃U┃ M ┃ E ┃ O ┃
┗━┻━━━┻━━━┻━━━━━━━━━━━━━━━━━━━━━━┈┈┈┈┈┈┈┈━━━━━━━┛
64 63 59 56 0Where:
Uis an unused reserved bit, always set to 0 (bit 63).Mis the index mode, always set to 2, coded on 4 bits (59-62).Eis the edge of the origin cell, in [1; 6], coded on 3 bits (56-58).Ois the origin cell index, coded on 56 bits (0-55).
References:
Implementations§
Source§impl DirectedEdgeIndex
impl DirectedEdgeIndex
Sourcepub fn edge(self) -> Edge
pub fn edge(self) -> Edge
Returns the cell edge.
§Example
let index = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?;
assert_eq!(index.edge(), h3o::Edge::try_from(3)?);Sourcepub fn origin(self) -> CellIndex
pub fn origin(self) -> CellIndex
Returns the origin hexagon from the directed edge index.
§Example
let index = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?;
assert_eq!(index.origin(), h3o::CellIndex::try_from(0x8a194e699ab7fff)?);Sourcepub fn destination(self) -> CellIndex
pub fn destination(self) -> CellIndex
Returns the destination hexagon from the directed edge index.
§Example
let index = h3o::DirectedEdgeIndex::try_from(0x13a1_94e6_99ab_7fff)?;
assert_eq!(index.destination(), h3o::CellIndex::try_from(0x8a194e699a97fff)?);Sourcepub fn cells(self) -> (CellIndex, CellIndex)
pub fn cells(self) -> (CellIndex, CellIndex)
Returns the (origin, destination) pair of cell index for this edge.
§Example
let index = h3o::DirectedEdgeIndex::try_from(0x13a1_94e6_99ab_7fff)?;
assert_eq!(index.cells(), (
h3o::CellIndex::try_from(0x8a194e699ab7fff)?,
h3o::CellIndex::try_from(0x8a194e699a97fff)?,
));Sourcepub fn boundary(self) -> Boundary
pub fn boundary(self) -> Boundary
Returns the coordinates defining the directed edge.
§Example
let index = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?;
let boundary = index.boundary();Sourcepub fn length_rads(self) -> f64
pub fn length_rads(self) -> f64
Computes the length of this directed edge, in radians.
§Example
let index = h3o::DirectedEdgeIndex::try_from(0x13a194e699ab7fff)?;
float_eq::assert_float_eq!(
index.length_rads(),
1.1795418098325597e-5,
abs <= 1e-11
);Trait Implementations§
Source§impl<'a> Arbitrary<'a> for DirectedEdgeIndex
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for DirectedEdgeIndex
Available on crate feature
arbitrary only.Source§fn arbitrary(data: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(data: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§impl Binary for DirectedEdgeIndex
impl Binary for DirectedEdgeIndex
Source§impl Clone for DirectedEdgeIndex
impl Clone for DirectedEdgeIndex
Source§fn clone(&self) -> DirectedEdgeIndex
fn clone(&self) -> DirectedEdgeIndex
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DirectedEdgeIndex
impl Debug for DirectedEdgeIndex
Source§impl<'de> Deserialize<'de> for DirectedEdgeIndex
impl<'de> Deserialize<'de> for DirectedEdgeIndex
Source§fn 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
Source§impl Display for DirectedEdgeIndex
impl Display for DirectedEdgeIndex
Source§impl From<DirectedEdgeIndex> for Line
Available on crate feature geo only.
impl From<DirectedEdgeIndex> for Line
Available on crate feature
geo only.Source§fn from(value: DirectedEdgeIndex) -> Self
fn from(value: DirectedEdgeIndex) -> Self
Converts to this type from the input type.
Source§impl From<DirectedEdgeIndex> for u64
impl From<DirectedEdgeIndex> for u64
Source§fn from(value: DirectedEdgeIndex) -> Self
fn from(value: DirectedEdgeIndex) -> Self
Converts to this type from the input type.
Source§impl FromStr for DirectedEdgeIndex
impl FromStr for DirectedEdgeIndex
Source§impl Hash for DirectedEdgeIndex
impl Hash for DirectedEdgeIndex
Source§impl LowerHex for DirectedEdgeIndex
impl LowerHex for DirectedEdgeIndex
Source§impl Octal for DirectedEdgeIndex
impl Octal for DirectedEdgeIndex
Source§impl Ord for DirectedEdgeIndex
impl Ord for DirectedEdgeIndex
Source§impl PartialEq for DirectedEdgeIndex
impl PartialEq for DirectedEdgeIndex
Source§impl PartialOrd for DirectedEdgeIndex
impl PartialOrd for DirectedEdgeIndex
Source§impl Serialize for DirectedEdgeIndex
impl Serialize for DirectedEdgeIndex
Source§impl TryFrom<u64> for DirectedEdgeIndex
impl TryFrom<u64> for DirectedEdgeIndex
Source§impl UpperHex for DirectedEdgeIndex
impl UpperHex for DirectedEdgeIndex
impl Copy for DirectedEdgeIndex
impl Eq for DirectedEdgeIndex
impl StructuralPartialEq for DirectedEdgeIndex
Auto Trait Implementations§
impl Freeze for DirectedEdgeIndex
impl RefUnwindSafe for DirectedEdgeIndex
impl Send for DirectedEdgeIndex
impl Sync for DirectedEdgeIndex
impl Unpin for DirectedEdgeIndex
impl UnwindSafe for DirectedEdgeIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more