Skip to main content

TrackIntervals

Struct TrackIntervals 

Source
struct TrackIntervals {
    intervals: SmallVec<[OccupiedInterval; 2]>,
}
Expand description

The occupied cells of a single track, stored as a sorted list of disjoint intervals in OriginZero line coordinates. Gaps between intervals are unoccupied. Touching intervals with the same state are merged.

Fields§

§intervals: SmallVec<[OccupiedInterval; 2]>

The sorted, disjoint list of occupied intervals within the track

Implementations§

Source§

impl TrackIntervals

Source

fn is_empty(&self) -> bool

Whether the track contains any occupied cells

Source

fn state_at(&self, coordinate: i16) -> CellOccupancyState

The occupancy state of the cell whose start line is at coordinate

Source

fn paint(&mut self, range: Range<i16>, state: CellOccupancyState)

Set the cells covered by range to state, overwriting the state of any already-occupied cells within the range (matching the overwrite semantics of a dense matrix of cells)

Source

fn collision_extent(&self, range: &Range<i16>, reversed: bool) -> Option<i16>

Find the extent of the occupied interval which an auto-placement search along the track would collide with last: the end of the last overlapping interval when searching forwards, or the start of the first overlapping interval when searching backwards (reversed == true). Returns the extremal occupied cell of that interval (which may lie outside range: every search position before the returned extent also collides with the interval), or None if the range is entirely unoccupied.

Source

fn first_of_state(&self, state: CellOccupancyState) -> Option<i16>

The start line of the first (lowest coordinate) cell with the specified state, if any

Source

fn last_of_state(&self, state: CellOccupancyState) -> Option<i16>

The start line of the last (highest coordinate) cell with the specified state, if any

Trait Implementations§

Source§

impl Clone for TrackIntervals

Source§

fn clone(&self) -> TrackIntervals

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 Debug for TrackIntervals

Source§

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

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

impl Default for TrackIntervals

Source§

fn default() -> TrackIntervals

Returns the “default value” for a type. 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> 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.