Struct GeoShape

Source
pub struct GeoShape<TMapping>
where TMapping: GeoShapeMapping,
{ /* private fields */ }
Expand description

Geo shape type with a given mapping.

Defining a geo_shape with a mapping:

extern crate geojson;
use geojson::{ Geometry, Value };

let point: GeoShape<DefaultGeoShapeMapping> = GeoShape::new(
    Geometry::new(
        Value::Point(vec![ 1.0, 1.0 ])
    )
);

Implementations§

Source§

impl<TMapping> GeoShape<TMapping>
where TMapping: GeoShapeMapping,

Source

pub fn new<I>(geo: I) -> GeoShape<TMapping>
where I: Into<Geometry>,

Creates a new GeoShape from the given Geometry.

This function will consume the provided Geometry.

§Examples
use geojson::{ Geometry, Value };
    
let point: GeoShape<DefaultGeoShapeMapping> = GeoShape::new(
    Geometry::new(
        Value::Point(vec![ 1.0, 1.0 ])
    )
);
Source

pub fn remap<TNewMapping>(shape: GeoShape<TMapping>) -> GeoShape<TNewMapping>
where TNewMapping: GeoShapeMapping,

Change the mapping of this geo shape.

Trait Implementations§

Source§

impl<M> Borrow<Geometry> for GeoShape<M>
where M: GeoShapeMapping,

Source§

fn borrow(&self) -> &Geometry

Immutably borrows from an owned value. Read more
Source§

impl<TMapping> Clone for GeoShape<TMapping>
where TMapping: GeoShapeMapping + Clone,

Source§

fn clone(&self) -> GeoShape<TMapping>

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<TMapping> Debug for GeoShape<TMapping>
where TMapping: GeoShapeMapping + Debug,

Source§

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

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

impl<M> Deref for GeoShape<M>
where M: GeoShapeMapping,

Source§

type Target = Geometry

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Geometry

Dereferences the value.
Source§

impl<'de, TMapping> Deserialize<'de> for GeoShape<TMapping>
where TMapping: GeoShapeMapping,

Source§

fn deserialize<D>(deserializer: D) -> Result<GeoShape<TMapping>, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<M> From<Geometry> for GeoShape<M>
where M: GeoShapeMapping,

Source§

fn from(value: Geometry) -> Self

Converts to this type from the input type.
Source§

impl<M> PartialEq<GeoShape<M>> for Geometry
where M: GeoShapeMapping,

Source§

fn eq(&self, other: &GeoShape<M>) -> bool

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

fn ne(&self, other: &GeoShape<M>) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<M> PartialEq<Geometry> for GeoShape<M>
where M: GeoShapeMapping,

Source§

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

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

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<TMapping> PartialEq for GeoShape<TMapping>
where TMapping: GeoShapeMapping + PartialEq,

Source§

fn eq(&self, other: &GeoShape<TMapping>) -> 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<TMapping> Serialize for GeoShape<TMapping>
where TMapping: GeoShapeMapping,

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<TMapping> GeoShapeFieldType<TMapping> for GeoShape<TMapping>
where TMapping: GeoShapeMapping,

Source§

impl<TMapping> StructuralPartialEq for GeoShape<TMapping>
where TMapping: GeoShapeMapping,

Auto Trait Implementations§

§

impl<TMapping> Freeze for GeoShape<TMapping>

§

impl<TMapping> RefUnwindSafe for GeoShape<TMapping>
where TMapping: RefUnwindSafe,

§

impl<TMapping> Send for GeoShape<TMapping>
where TMapping: Send,

§

impl<TMapping> Sync for GeoShape<TMapping>
where TMapping: Sync,

§

impl<TMapping> Unpin for GeoShape<TMapping>
where TMapping: Unpin,

§

impl<TMapping> UnwindSafe for GeoShape<TMapping>
where TMapping: UnwindSafe,

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

unsafe fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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, 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>,