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 Value
where T: CoordFloat,

source§

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

Convert from geo_types::Geometry enums

source§

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

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 Value
where T: CoordFloat,

source§

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

Converts to this type from the input type.
source§

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

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 Value
where T: CoordFloat,

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 Value
where T: CoordFloat,

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 Value
where T: CoordFloat,

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 Value
where T: CoordFloat,

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

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

source§

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

source§

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,

source§

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,

source§

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,

source§

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,

source§

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,

source§

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,

source§

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,

source§

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

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

source§

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>

source§

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>

source§

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>

source§

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>

source§

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>

source§

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>

source§

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>

source§

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

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 Value

Auto Trait Implementations§

§

impl Freeze for Value

§

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 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.