Struct geojson::Feature

source ·
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

Fields§

§bbox: Option<Bbox>§geometry: Option<Geometry>§id: Option<Id>§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>

Implementations§

source§

impl Feature

source

pub fn from_json_object(object: JsonObject) -> Result<Self>

source

pub fn from_json_value(value: JsonValue) -> Result<Self>

source

pub fn property(&self, key: impl AsRef<str>) -> Option<&JsonValue>

Return the value of this property, if it’s set

source

pub fn contains_property(&self, key: impl AsRef<str>) -> bool

Return true iff this key is set

source

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

source

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.

source

pub fn len_properties(&self) -> usize

The number of properties

source

pub fn properties_iter( &self ) -> Box<dyn ExactSizeIterator<Item = (&String, &JsonValue)> + '_>

Returns an iterator over all the properties

Trait Implementations§

source§

impl Clone for Feature

source§

fn clone(&self) -> Feature

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Feature

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Feature

source§

fn default() -> Feature

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Feature

source§

fn deserialize<D>(deserializer: D) -> Result<Feature, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Feature

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a Feature> for JsonObject

source§

fn from(feature: &'a Feature) -> JsonObject

Converts to this type from the input type.
source§

impl From<Feature> for GeoJson

source§

fn from(feature: Feature) -> Self

Converts to this type from the input type.
source§

impl From<Geometry> for Feature

source§

fn from(geom: Geometry) -> Feature

Converts to this type from the input type.
source§

impl From<Value> for Feature

source§

fn from(val: Value) -> Feature

Converts to this type from the input type.
source§

impl FromIterator<Feature> for FeatureCollection

Create a FeatureCollection using the collect method on an iterator of Features. 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.

source§

fn from_iter<T: IntoIterator<Item = Feature>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl FromStr for Feature

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
source§

impl PartialEq<Feature> for Feature

source§

fn eq(&self, other: &Feature) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Feature

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T> TryFrom<Feature> for Geometry<T>where T: CoordFloat,

Available on crate feature geo-types only.
§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(val: Feature) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<Feature> for GeometryCollection<T>where T: CoordFloat,

Available on crate feature geo-types only.
§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(val: Feature) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<Feature> for LineString<T>where T: CoordFloat,

Available on crate feature geo-types only.
§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(val: Feature) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<Feature> for MultiLineString<T>where T: CoordFloat,

Available on crate feature geo-types only.
§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(val: Feature) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<Feature> for MultiPoint<T>where T: CoordFloat,

Available on crate feature geo-types only.
§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(val: Feature) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<Feature> for MultiPolygon<T>where T: CoordFloat,

Available on crate feature geo-types only.
§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(val: Feature) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<Feature> for Point<T>where T: CoordFloat,

Available on crate feature geo-types only.
§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(val: Feature) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<Feature> for Polygon<T>where T: CoordFloat,

Available on crate feature geo-types only.
§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(val: Feature) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<GeoJson> for Feature

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: GeoJson) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Map<String, Value>> for Feature

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(object: JsonObject) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Value> for Feature

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: JsonValue) -> Result<Self>

Performs the conversion.
source§

impl StructuralPartialEq for Feature

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,