Skip to main content

Topology

Struct Topology 

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

Shared planar layers and ordered rules with reusable, thread-safe geometry caches.

Implementations§

Source§

impl Topology

Source

pub fn new(tolerance: f64) -> Result<Self, Error>

Create an empty topology with tolerance in input coordinate units. Zero requests exact comparisons; no CRS transformation is performed.

§Errors

Returns Error::Tolerance for a negative or non-finite tolerance.

Source

pub fn tolerance(&self) -> f64

Return the configured planar tolerance.

Source

pub fn add_layer(&mut self, layer: impl Into<Arc<Layer>>) -> LayerId

Register a layer without validating it, returning a topology-scoped ID. Pass an Arc<Layer> to share one layer, and its cached views, between topologies.

Source

pub fn layer(&self, id: LayerId) -> Result<&Layer, Error>

Borrow a registered layer. IDs must originate from this topology.

§Errors

Returns Error::UnknownLayer when the index is not registered.

Source

pub fn layers(&self) -> impl Iterator<Item = (LayerId, &Layer)>

Iterate layers and their IDs in registration order.

Source

pub fn rules(&self) -> impl ExactSizeIterator<Item = RuleSpec>

Iterate registered rules in registration order.

Source

pub fn clear_rules(&mut self)

Remove every registered rule, keeping layers and their cached line graphs, so a different rule set can be validated without rebuilding them. Rule IDs restart at zero; IDs from earlier registrations must not be reused.

Source

pub fn add_rule( &mut self, rule: Rule, layer: LayerId, other: Option<LayerId>, ) -> Result<RuleSpec, Error>

Register a rule after validating input families, finite coordinates and FIDs. Unary rules require no secondary layer; binary rules require a distinct one. Rules run in parallel, but reports retain registration order. The returned spec’s id locates this rule’s result with Report::rule.

§Errors

Returns input-count, same-layer, unknown-layer, geometry-kind, duplicate-FID or non-finite-coordinate errors. Failed registration does not add a rule.

Source

pub fn register_rule( &mut self, rule: Rule, layer: LayerInput, other: Option<LayerInput>, ) -> Result<RuleSpec, Error>

Validate and commit owned inputs and a rule as one transaction. Layer caches do not depend on registration IDs, so validation work done here is reused after commit.

§Errors

Returns arity, same-layer, unknown-layer, geometry-kind, duplicate-FID or coordinate errors before committing any new layer or rule.

Source

pub fn warnings(&self) -> Result<Vec<Warning>, Error>

Validate cached part views and report skipped degenerate parts without running rules.

§Errors

Returns duplicate-FID or non-finite-coordinate errors from any registered layer, including layers that are not used by a rule.

Source

pub fn validate(&self) -> Result<Report, Error>

Validate all layers and execute registered rules, reusing cached views. Topology violations are a successful report, not operational errors.

§Errors

Returns invalid-layer errors from deferred validation or operational errors encountered while building rule inputs. No partial report is returned.

Trait Implementations§

Source§

impl Debug for Topology

Source§

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

Formats the value using the given formatter. 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<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