pub struct ZoneTree {
pub world_id: String,
pub zones: HashMap<String, Zone>,
pub children: HashMap<String, Vec<String>>,
}
Expand description
The zone tree, constructed and cached from the list of zones.
Fields§
§world_id: String
§zones: HashMap<String, Zone>
§children: HashMap<String, Vec<String>>
Implementations§
Source§impl ZoneTree
impl ZoneTree
pub fn new(zones: Vec<Zone>) -> Self
pub fn get_zone(&self, zone_id: &str) -> Option<&Zone>
pub fn get_children(&self, zone_id: &str) -> Option<&Vec<String>>
Sourcepub fn get_country_or_higher(&self, zone_id: &str) -> Option<&Zone>
pub fn get_country_or_higher(&self, zone_id: &str) -> Option<&Zone>
If the zone is a region, province, state, etc, ascend the tree to get the country. If the zone is a country, continent, or world, return it.
pub fn world(&self) -> &Zone
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ZoneTree
impl<'de> Deserialize<'de> for ZoneTree
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
Auto Trait Implementations§
impl Freeze for ZoneTree
impl RefUnwindSafe for ZoneTree
impl Send for ZoneTree
impl Sync for ZoneTree
impl Unpin for ZoneTree
impl UnwindSafe for ZoneTree
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