pub struct Feature {
pub bbox: Option<Bbox>,
pub geometry: Option<Geometry>,
pub id: Option<Id>,
pub properties: Option<JsonObject>,
pub foreign_members: Option<JsonObject>,
}
Expand description
Feature Objects
Fields§
§bbox: Option<Bbox>
Bounding Box
geometry: Option<Geometry>
Geometry
id: Option<Id>
Identifier
properties: Option<JsonObject>
Properties
GeoJSON Format Specification § 3.2
NOTE: This crate will permissively parse a Feature whose json is missing a properties
key.
Because the spec implies that the properties
key must be present, we will always include
the properties
key when serializing.
foreign_members: Option<JsonObject>
Foreign Members
Implementations§
Source§impl Feature
impl Feature
pub fn from_json_object(object: JsonObject) -> Result<Self>
pub fn from_json_value(value: JsonValue) -> Result<Self>
Sourcepub fn property(&self, key: impl AsRef<str>) -> Option<&JsonValue>
pub fn property(&self, key: impl AsRef<str>) -> Option<&JsonValue>
Return the value of this property, if it’s set
Sourcepub fn contains_property(&self, key: impl AsRef<str>) -> bool
pub fn contains_property(&self, key: impl AsRef<str>) -> bool
Return true iff this key is set
Sourcepub fn set_property(
&mut self,
key: impl Into<String>,
value: impl Into<JsonValue>,
)
pub fn set_property( &mut self, key: impl Into<String>, value: impl Into<JsonValue>, )
Set a property to this value, overwriting any possible older value
Sourcepub fn remove_property(&mut self, key: impl AsRef<str>) -> Option<JsonValue>
pub fn remove_property(&mut self, key: impl AsRef<str>) -> Option<JsonValue>
Removes a key from the properties
map, returning the value at the key if the key
was previously in the properties
map.
Sourcepub fn len_properties(&self) -> usize
pub fn len_properties(&self) -> usize
The number of properties
Sourcepub fn properties_iter(
&self,
) -> Box<dyn ExactSizeIterator<Item = (&String, &JsonValue)> + '_>
pub fn properties_iter( &self, ) -> Box<dyn ExactSizeIterator<Item = (&String, &JsonValue)> + '_>
Returns an iterator over all the properties
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Feature
impl<'de> Deserialize<'de> for Feature
Source§fn deserialize<D>(deserializer: D) -> Result<Feature, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Feature, D::Error>where
D: Deserializer<'de>,
Source§impl<'a> From<&'a Feature> for JsonObject
impl<'a> From<&'a Feature> for JsonObject
Source§fn from(feature: &'a Feature) -> JsonObject
fn from(feature: &'a Feature) -> JsonObject
Source§impl FromIterator<Feature> for FeatureCollection
Create a FeatureCollection
using the collect
method on an iterator of Feature
s. If every item
contains a bounding-box of the same dimension, then the
output has a bounding-box of the union of them.
Otherwise, the output will not have a bounding-box.
impl FromIterator<Feature> for FeatureCollection
Create a FeatureCollection
using the collect
method on an iterator of Feature
s. If every item
contains a bounding-box of the same dimension, then the
output has a bounding-box of the union of them.
Otherwise, the output will not have a bounding-box.