[−][src]Enum geojson::GeoJson
GeoJSON Objects
Variants
Geometry(Geometry)
Feature(Feature)
FeatureCollection(FeatureCollection)
Methods
impl GeoJson
[src]
pub fn from_json_object(object: Map<String, JsonValue>) -> Result<Self, Error>
[src]
pub fn from_json_value(value: JsonValue) -> Result<Self, Error>
[src]
Converts a JSON Value into a GeoJson object.
Example
use std::convert::TryInto; use geojson::{Feature, GeoJson, Geometry, Value}; use serde_json::json; let json_value = json!({ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": null, }); assert!(json_value.is_object()); let geojson: GeoJson = json_value.try_into().unwrap(); assert_eq!( geojson, GeoJson::Feature(Feature { bbox: None, geometry: Some(Geometry::new(Value::Point(vec![102.0, 0.5]))), id: None, properties: None, foreign_members: None, }) );
Trait Implementations
impl Clone for GeoJson
[src]
impl Debug for GeoJson
[src]
impl<'de> Deserialize<'de> for GeoJson
[src]
fn deserialize<D>(deserializer: D) -> Result<GeoJson, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for GeoJson
[src]
impl<'a> From<&'a GeoJson> for Map<String, JsonValue>
[src]
impl From<Feature> for GeoJson
[src]
impl From<FeatureCollection> for GeoJson
[src]
fn from(feature_collection: FeatureCollection) -> GeoJson
[src]
impl From<Geometry> for GeoJson
[src]
impl FromStr for GeoJson
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl PartialEq<GeoJson> for GeoJson
[src]
impl Serialize for GeoJson
[src]
impl StructuralPartialEq for GeoJson
[src]
impl TryFrom<Map<String, Value>> for GeoJson
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(object: Map<String, JsonValue>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Value> for GeoJson
[src]
Auto Trait Implementations
impl RefUnwindSafe for GeoJson
impl Send for GeoJson
impl Sync for GeoJson
impl Unpin for GeoJson
impl UnwindSafe for GeoJson
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,