Enum geojson::Value

source ·
pub enum Value {
    Point(PointType),
    MultiPoint(Vec<PointType>),
    LineString(LineStringType),
    MultiLineString(Vec<LineStringType>),
    Polygon(PolygonType),
    MultiPolygon(Vec<PolygonType>),
    GeometryCollection(Vec<Geometry>),
}
Expand description

The underlying value for a Geometry.

Conversion from geo_types

A Value can be created by using the From impl which is available for both geo_types primitives AND geo_types::Geometry enum members:

let point = geo_types::Point::new(2., 9.);
let genum = geo_types::Geometry::from(point);
assert_eq!(
    geojson::Value::from(&point),
    geojson::Value::Point(vec![2., 9.]),
);
assert_eq!(
    geojson::Value::from(&genum),
    geojson::Value::Point(vec![2., 9.]),
);

Variants§

Implementations§

source§

impl Value

source

pub fn type_name(&self) -> &'static str

source§

impl Value

source

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

source

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

Trait Implementations§

source§

impl Clone for Value

source§

fn clone(&self) -> Value

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 Value

source§

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

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

impl Display for Value

source§

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

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

impl<'a, T> From<&'a Geometry<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(geometry: &'a Geometry<T>) -> Self

Convert from geo_types::Geometry enums

source§

impl<'a, T> From<&'a GeometryCollection<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(geometry_collection: &GeometryCollection<T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a Line<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(line: &Line<T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a LineString<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(line_string: &LineString<T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a MultiLineString<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(multi_line_string: &MultiLineString<T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a MultiPoint<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(multi_point: &MultiPoint<T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a MultiPolygon<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(multi_polygon: &MultiPolygon<T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a Point<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(point: &Point<T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a Polygon<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(polygon: &Polygon<T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a Rect<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(rect: &Rect<T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a Triangle<T>> for Valuewhere T: CoordFloat,

Available on crate feature geo-types only.
source§

fn from(triangle: &Triangle<T>) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(value: &'a Value) -> JsonObject

Converts to this type from the input type.
source§

impl<'a> From<&'a Value> for JsonValue

source§

fn from(value: &'a Value) -> JsonValue

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 PartialEq<Value> for Value

source§

fn eq(&self, other: &Value) -> 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 Value

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<&Value> 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(value: &Value) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<&Value> 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(value: &Value) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<&Value> 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(value: &Value) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<&Value> 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(value: &Value) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<&Value> 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(value: &Value) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<&Value> 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(value: &Value) -> Result<MultiPolygon<T>>

Performs the conversion.
source§

impl<T> TryFrom<&Value> 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(value: &Value) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<&Value> 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(value: &Value) -> Result<Self>

Performs the conversion.
source§

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

§

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<T: CoordFloat> TryFrom<Value> for Geometry<T>

Available on crate feature geo-types only.
§

type Error = Error

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

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

Performs the conversion.
source§

impl<T: CoordFloat> TryFrom<Value> for GeometryCollection<T>

Available on crate feature geo-types only.
§

type Error = Error

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

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

Performs the conversion.
source§

impl<T: CoordFloat> TryFrom<Value> for LineString<T>

Available on crate feature geo-types only.
§

type Error = Error

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

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

Performs the conversion.
source§

impl<T: CoordFloat> TryFrom<Value> for MultiLineString<T>

Available on crate feature geo-types only.
§

type Error = Error

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

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

Performs the conversion.
source§

impl<T: CoordFloat> TryFrom<Value> for MultiPoint<T>

Available on crate feature geo-types only.
§

type Error = Error

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

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

Performs the conversion.
source§

impl<T: CoordFloat> TryFrom<Value> for MultiPolygon<T>

Available on crate feature geo-types only.
§

type Error = Error

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

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

Performs the conversion.
source§

impl<T: CoordFloat> TryFrom<Value> for Point<T>

Available on crate feature geo-types only.
§

type Error = Error

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

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

Performs the conversion.
source§

impl<T: CoordFloat> TryFrom<Value> for Polygon<T>

Available on crate feature geo-types only.
§

type Error = Error

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

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

Performs the conversion.
source§

impl TryFrom<Value> for Value

§

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 Value

Auto Trait Implementations§

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

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.