Skip to main content

Layer

Struct Layer 

Source
pub struct Layer { /* private fields */ }
Expand description

An owned planar layer. Cached views cannot be invalidated through mutation.

Caches do not depend on a topology or LayerId, so one Arc<Layer> can be registered in several topologies and its cleaned parts, indexes, polygon union and cross-geometry views are built once and reused.

Construction defers finite-coordinate and duplicate-FID checks until rule registration, warnings or validation. Cleaning removes consecutive duplicate coordinates and skips lines with fewer than two coordinates and polygon rings with fewer than four coordinates or three distinct vertices. A degenerate exterior skips the polygon; degenerate holes are skipped individually. Part indices retain the original traversal positions. Coordinate units are supplied by the caller; the core does not interpret or transform a CRS.

Implementations§

Source§

impl Layer

Source

pub fn from_geometries( name: impl Into<String>, geometries: impl IntoIterator<Item = Geometry>, ) -> Self

Own geometries in input order, assigning signed FIDs starting at zero. Validation is deferred until this layer’s parts are requested.

Source

pub fn from_features( name: impl Into<String>, features: impl IntoIterator<Item = (i64, Geometry)>, ) -> Self

Own features in input order, preserving signed FIDs and original geometries. FIDs must be unique within this layer; validation is deferred.

Source

pub fn name(&self) -> &str

Return the caller-supplied layer name, which need not be unique.

Source

pub fn features(&self) -> impl ExactSizeIterator<Item = (i64, &Geometry)>

Iterate original, uncleaned features in input order.

Source

pub fn feature(&self, index: usize) -> Option<(i64, &Geometry)>

Return the original feature at a zero-based input position.

Source

pub fn len(&self) -> usize

Return the number of original features, including degenerate geometries.

Source

pub fn is_empty(&self) -> bool

Return whether the layer contains no original features.

Trait Implementations§

Source§

impl Debug for Layer

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Layer

§

impl RefUnwindSafe for Layer

§

impl Send for Layer

§

impl Sync for Layer

§

impl Unpin for Layer

§

impl UnsafeUnpin for Layer

§

impl UnwindSafe for Layer

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
§

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

§

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