pub struct Cell(/* private fields */);Expand description
HexTreeMap’s key type.
Implementations§
Source§impl Cell
impl Cell
Sourcepub const fn from_raw(raw: u64) -> Result<Self>
pub const fn from_raw(raw: u64) -> Result<Self>
Constructs a new Cell from a raw u64 H3 index.
§Errors
Returns an error if u64 is not a valid bit-representation of an H3 cell (mode 1 H3 index).
Sourcepub const fn to_parent(&self, res: u8) -> Option<Self>
pub const fn to_parent(&self, res: u8) -> Option<Self>
Returns this cell’s parent at the specified resolution.
Returns Some if res is less-than or equal-to this cell’s
resolution, otherwise returns None.
Returns true if self is related to other.
“Related” can be any of the following:
self==otherselfis a parent cell ofotherotheris a parent cell ofself
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Cell
impl<'de> Deserialize<'de> for Cell
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>,
Source§impl<'a> FromIterator<&'a Cell> for HexTreeSet
impl<'a> FromIterator<&'a Cell> for HexTreeSet
Source§impl FromIterator<Cell> for HexTreeSet
impl FromIterator<Cell> for HexTreeSet
Source§impl<V, C> Index<&Cell> for HexTreeMap<V, C>
impl<V, C> Index<&Cell> for HexTreeMap<V, C>
Source§fn index(&self, cell: &Cell) -> &V
fn index(&self, cell: &Cell) -> &V
Returns a reference to the value corresponding to the supplied key.
§Examples
use hextree::{Cell, HexTreeMap};
let mut map = HexTreeMap::new();
let eiffel_tower_res12 = Cell::from_raw(0x8c1fb46741ae9ff)?;
map.insert(eiffel_tower_res12, "France");
assert_eq!(map[&eiffel_tower_res12], "France");§Panics
Panics if the cell is not present in the HexTreeMap.
Source§impl<V, C> Index<Cell> for HexTreeMap<V, C>
impl<V, C> Index<Cell> for HexTreeMap<V, C>
Source§fn index(&self, cell: Cell) -> &V
fn index(&self, cell: Cell) -> &V
Returns a reference to the value corresponding to the supplied key.
§Examples
use hextree::{Cell, HexTreeMap};
let mut map = HexTreeMap::new();
let eiffel_tower_res12 = Cell::from_raw(0x8c1fb46741ae9ff)?;
map.insert(eiffel_tower_res12, "France");
assert_eq!(map[eiffel_tower_res12], "France");§Panics
Panics if the cell is not present in the HexTreeMap.
Source§impl<V, C> IndexMut<&Cell> for HexTreeMap<V, C>
impl<V, C> IndexMut<&Cell> for HexTreeMap<V, C>
Source§fn index_mut(&mut self, cell: &Cell) -> &mut V
fn index_mut(&mut self, cell: &Cell) -> &mut V
Returns a reference to the value corresponding to the supplied key.
§Examples
use hextree::{Cell, HexTreeMap};
let mut map = HexTreeMap::new();
let eiffel_tower_res12 = Cell::from_raw(0x8c1fb46741ae9ff)?;
map.insert(eiffel_tower_res12, "France");
assert_eq!(map[&eiffel_tower_res12], "France");
map[&eiffel_tower_res12] = "Paris";
assert_eq!(map[&eiffel_tower_res12], "Paris");§Panics
Panics if the cell is not present in the HexTreeMap.
Source§impl<V, C> IndexMut<Cell> for HexTreeMap<V, C>
impl<V, C> IndexMut<Cell> for HexTreeMap<V, C>
Source§fn index_mut(&mut self, cell: Cell) -> &mut V
fn index_mut(&mut self, cell: Cell) -> &mut V
Returns a reference to the value corresponding to the supplied key.
§Examples
use hextree::{Cell, HexTreeMap};
let mut map = HexTreeMap::new();
let eiffel_tower_res12 = Cell::from_raw(0x8c1fb46741ae9ff)?;
map.insert(eiffel_tower_res12, "France");
assert_eq!(map[eiffel_tower_res12], "France");
map[eiffel_tower_res12] = "Paris";
assert_eq!(map[eiffel_tower_res12], "Paris");§Panics
Panics if the cell is not present in the HexTreeMap.