Struct LayeredCell

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

Ordered surface crossings plus sorted, strictly disjoint occupancy spans.

Both channels may be empty, hold one entry, or hold many; a cell never selects a “primary” layer.

Implementations§

Source§

impl LayeredCell

Source

pub const fn empty() -> Self

An empty column.

Source

pub fn new(occupancy: Vec<Interval>) -> Result<Self, LayeredFieldError>

Construct an occupancy-only column.

Source

pub fn with_layers( surfaces: Vec<SurfaceHit>, occupancy: Vec<Interval>, ) -> Result<Self, LayeredFieldError>

Construct a validated column with both channels.

Surfaces are sorted by w, then by facing so equal-coordinate ties are deterministic. Occupancy is sorted and must be strictly disjoint; touching or overlapping spans are rejected rather than merged, because a merge would silently erase a topology fact the caller may need.

Source

pub fn surfaces(&self) -> &[SurfaceHit]

Crossings in increasing layer order.

Source

pub fn occupancy(&self) -> &[Interval]

Occupied spans in increasing layer order.

Source

pub fn layer_count(&self) -> usize

Total stored layers in both channels.

Source

pub fn is_empty(&self) -> bool

Whether both channels are empty.

Source

pub fn derive_occupancy( &self, tolerance: Tolerance, ) -> Result<Self, LayeredFieldError>

Pair alternating crossings into occupancy spans for a closed shell.

The sequence must alternate AgainstNormal (enter) then WithNormal (exit); anything else is reported as LayeredFieldError::UnbalancedCrossings rather than guessed. A pair whose span is within the linear tolerance is reported as LayeredFieldError::DegenerateOccupancy.

Source

pub fn largest_free_span(&self, search: Interval) -> Option<Interval>

Largest unoccupied span strictly inside search, or None when the window is fully occupied.

This reports a distance. It does not decide whether that distance is sufficient for any purpose.

Trait Implementations§

Source§

impl Clone for LayeredCell

Source§

fn clone(&self) -> LayeredCell

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 LayeredCell

Source§

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

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

impl Default for LayeredCell

Source§

fn default() -> LayeredCell

Returns the “default value” for a type. Read more
Source§

impl PartialEq for LayeredCell

Source§

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

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