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

source§

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 for Feature

source§

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

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

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

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,

source§

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,

source§

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,

source§

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,

source§

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,

source§

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,

source§

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,

source§

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,

source§

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

source§

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

source§

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

source§

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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 T
where T: Clone,

source§

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 T
where 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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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 T
where T: for<'de> Deserialize<'de>,