Skip to main content

Geometry

Enum Geometry 

Source
pub enum Geometry {
    Point(Point<f64>),
    Line(LineString<f64>),
    Polygon(Polygon<f64>),
    MultiPoint(MultiPoint<f64>),
    MultiLine(MultiLineString<f64>),
    MultiPolygon(MultiPolygon<f64>),
    Collection(Vec<Geometry>),
}

Variants§

§

Point(Point<f64>)

§

Line(LineString<f64>)

§

Polygon(Polygon<f64>)

§

MultiPoint(MultiPoint<f64>)

§

MultiLine(MultiLineString<f64>)

§

MultiPolygon(MultiPolygon<f64>)

§

Collection(Vec<Geometry>)

Implementations§

Source§

impl Geometry

Source

pub fn walk_revisioned_variant_name( wire_revision: u16, discriminant: u32, ) -> Option<&'static str>

Resolve a wire discriminant at wire_revision to the variant identifier at that revision. Returns None if no such variant exists at that revision.

Generated by the revisioned derive.

Source

pub fn walk_revisioned_variant_table( wire_revision: u16, ) -> &'static [(&'static str, u32)]

Variant name + discriminant pairs at wire_revision. Returns an empty slice if the revision is unknown. Generated by the revisioned derive.

Source§

impl Geometry

Source

pub const REVISION: u16 = 1u16

The revision number of this type, as declared via #[revisioned(revision = N)].

Source§

impl Geometry

Source

pub fn is_geometry(&self) -> bool

Check if this is not a Collection

Source

pub fn is_collection(&self) -> bool

Check if this is a Collection

Source

pub fn is_valid(&self) -> bool

Check if this has valid latitude and longitude points:

  • -90 <= lat <= 90
  • -180 <= lng <= 180
Source

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

Get the type of this Geometry as text

Source

pub fn as_coordinates(&self) -> Value

Get the raw coordinates of this Geometry as an Array

Source

pub fn as_object(&self) -> Object

Get the GeoJSON object representation for this geometry

Source

pub fn try_from_object(object: &Object) -> Option<Geometry>

Source

pub fn array_to_multipolygon(v: &Value) -> Option<MultiPolygon<f64>>

Converts a surreal value to a MultiPolygon if the array matches to a MultiPolygon.

Source

pub fn array_to_multiline(v: &Value) -> Option<MultiLineString<f64>>

Converts a surreal value to a MultiLine if the array matches to a MultiLine.

Source

pub fn array_to_multipoint(v: &Value) -> Option<MultiPoint<f64>>

Converts a surreal value to a MultiPoint if the array matches to a MultiPoint.

Source

pub fn array_to_polygon(v: &Value) -> Option<Polygon<f64>>

Converts a surreal value to a Polygon if the array matches to a Polygon.

Source

pub fn array_to_line(v: &Value) -> Option<LineString<f64>>

Converts a surreal value to a LineString if the array matches to a LineString.

Source

pub fn array_to_point(v: &Value) -> Option<Point<f64>>

Converts a surreal value to a Point if the array matches to a point.

Source

pub fn contains(&self, other: &Self) -> bool

Source

pub fn intersects(&self, other: &Self) -> bool

Trait Implementations§

Source§

impl<'de, F> BorrowDecode<'de, F> for Geometry

Source§

impl Cast for Geometry

Source§

fn can_cast(v: &Value) -> bool

Returns true if calling cast on the value will succeed. Read more
Source§

fn cast(v: Value) -> Result<Self, CastError>

Cast a value to the self type.
Source§

impl Clone for Geometry

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Coerce for Geometry

Source§

fn can_coerce(v: &Value) -> bool

Returns if calling coerce on the value will succeed or not. Read more
Source§

fn coerce(v: Value) -> Result<Self, CoerceError>

Coerce a value.
Source§

impl Debug for Geometry

Source§

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

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

impl DeserializeRevisioned for Geometry

Source§

fn deserialize_revisioned<R: Read>(reader: &mut R) -> Result<Self, Error>

Deserializes a new instance of the struct from the specified reader.
Source§

impl<F> Encode<F> for Geometry

Source§

fn encode<W: Write>(&self, w: &mut Writer<W>) -> Result<(), EncodeError>

Source§

impl From<(f64, f64)> for Geometry

Source§

fn from(v: (f64, f64)) -> Self

Converts to this type from the input type.
Source§

impl From<Geometry> for Geometry<f64>

Source§

fn from(v: Geometry) -> Self

Converts to this type from the input type.
Source§

impl From<Geometry> for Geometry

Source§

fn from(v: Geometry<f64>) -> Self

Convert from the upstream geometry enum.

geo’s enum is a superset of SurrealQL’s geometry variants: Rect and Triangle convert to their equivalent polygons, and a bare Line (segment) becomes a two-point line string.

Source§

impl From<Geometry> for Geometry

Source§

fn from(v: Geometry) -> Self

Converts to this type from the input type.
Source§

impl From<Geometry> for Geometry

Source§

fn from(v: Geometry) -> Self

Converts to this type from the input type.
Source§

impl From<Geometry> for Value

Source§

fn from(v: Geometry) -> Self

Converts to this type from the input type.
Source§

impl From<LineString> for Geometry

Source§

fn from(v: LineString<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<MultiLineString> for Geometry

Source§

fn from(v: MultiLineString<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<MultiPoint> for Geometry

Source§

fn from(v: MultiPoint<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<MultiPolygon> for Geometry

Source§

fn from(v: MultiPolygon<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<Point> for Geometry

Source§

fn from(v: Point<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<Polygon> for Geometry

Source§

fn from(v: Polygon<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Geometry>> for Geometry

Source§

fn from(v: Vec<Geometry>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<LineString>> for Geometry

Source§

fn from(v: Vec<LineString<f64>>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Point>> for Geometry

Source§

fn from(v: Vec<Point<f64>>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Polygon>> for Geometry

Source§

fn from(v: Vec<Polygon<f64>>) -> Self

Converts to this type from the input type.
Source§

impl From<[f64; 2]> for Geometry

Source§

fn from(v: [f64; 2]) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Geometry> for Geometry<f64>

Source§

fn from_iter<I: IntoIterator<Item = Geometry>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl HasKind for Geometry

Source§

impl Hash for Geometry

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Geometry

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for Geometry

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Revisioned for Geometry

Source§

fn revision() -> u16

Returns the current revision of this type.
Source§

fn type_id() -> TypeId
where Self: 'static,

Returns the type id of this type.
Source§

impl SerializeRevisioned for Geometry

Source§

fn serialize_revisioned<W: Write>(&self, writer: &mut W) -> Result<(), Error>

Serializes the struct using the specified writer.
Source§

impl SkipCheckRevisioned for Geometry

Source§

impl SkipRevisioned for Geometry

Source§

fn skip_revisioned<R: Read>(reader: &mut R) -> Result<(), Error>

Source§

fn skip_revisioned_slice(reader: &mut SliceReader<'_>) -> Result<(), Error>

Consume through bytes backed by SliceReader without allocating a buffer for bulk segments. Read more
Source§

impl StructuralPartialEq for Geometry

Source§

impl ToSql for Geometry

Source§

fn fmt_sql(&self, f: &mut String, sql_fmt: SqlFormat)

Format the type to a SQL string.
Source§

fn to_sql(&self) -> String

Convert the type to a SQL string.
Source§

fn to_sql_pretty(&self) -> String

Convert the type to a pretty-printed SQL string with indentation.
Source§

impl WalkRevisioned for Geometry

Source§

type Walker<'r, R: BorrowedReader + 'r> = GeometryWalker<'r, R>

Walker produced by walk_revisioned. Read more
Source§

fn walk_revisioned<'r, R: BorrowedReader>( reader: &'r mut R, ) -> Result<Self::Walker<'r, R>, Error>

Read the type’s revision-level prefix and return a walker positioned at the start of the body. Read more

Auto Trait Implementations§

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool