[][src]Struct geojson_antimeridian_cut::Geometry

pub struct Geometry {
    pub bbox: Option<Vec<f64>>,
    pub value: Value,
    pub foreign_members: Option<Map<String, Value>>,
}

Geometry Objects

GeoJSON Format Specification § 3.1

Examples

Constructing a Geometry:

use geojson::{Geometry, Value};

let geometry = Geometry::new(
    Value::Point(vec![7.428959, 1.513394]),
);

Serializing a Geometry to a GeoJSON string:

use geojson::{GeoJson, Geometry, Value};
use serde_json;

let geometry = Geometry::new(
    Value::Point(vec![7.428959, 1.513394]),
);

let geojson_string = geometry.to_string();

assert_eq!(
    "{\"coordinates\":[7.428959,1.513394],\"type\":\"Point\"}",
    geojson_string,
);

Deserializing a GeoJSON string into a Geometry:

use geojson::{GeoJson, Geometry, Value};

let geojson_str = "{\"coordinates\":[7.428959,1.513394],\"type\":\"Point\"}";

let geometry = match geojson_str.parse::<GeoJson>() {
    Ok(GeoJson::Geometry(g)) => g,
    _ => return,
};

assert_eq!(
    Geometry::new(
        Value::Point(vec![7.428959, 1.513394]),
    ),
    geometry,
);

Fields

bbox: Option<Vec<f64>>value: Valueforeign_members: Option<Map<String, Value>>

Methods

impl Geometry[src]

pub fn new(value: Value) -> Geometry[src]

Returns a new Geometry with the specified value. bbox and foreign_members will be set to None.

impl Geometry[src]

Trait Implementations

impl Debug for Geometry[src]

impl Display for Geometry[src]

impl From<Geometry> for GeoJson[src]

impl<'de> Deserialize<'de> for Geometry[src]

impl Serialize for Geometry[src]

impl StructuralPartialEq for Geometry[src]

impl PartialEq<Geometry> for Geometry[src]

impl Clone for Geometry[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]