Skip to main content

ClosedRouter

Struct ClosedRouter 

Source
pub struct ClosedRouter {
    pub(crate) inner: RouterNG,
}
Expand description

A RouterNG whose geometry has been built and frozen: it exposes routing and in-place edge-weight mutation, but no method to add segments/channels or rebuild the graph. Occupancy of a completed route is applied by adding WIRE_COST to the existing graph edges the wire covers, so no rebuild is needed (see Finding 1 in TUNING.md).

Fields§

§inner: RouterNG

Implementations§

Source§

impl ClosedRouter

Source

pub fn extended(self, add: impl FnOnce(&mut Opening<'_>)) -> Self

Add geometry to a closed lattice and close it again — how a foreground is replayed onto a clone of a cached background.

Insertion only. Nothing is ever taken out: a background is built from the complement of the foreground, and the foreground is added to a clone that is thrown away afterwards. So there is no inverse operation to get wrong — no provenance to refcount, no cost to subtract, no crossing node to heal.

The lattice is re-derived from the requests rather than patched, because a channel is clipped by the blocks present when it is seeded: a block added afterwards cannot be applied to the segments that came out, and splitting them around it would invent a channel on its far side that a whole build would never have produced.

Source

pub fn route_leg( &mut self, start: Point, end: Point, incoming: Option<Direction>, ) -> Leg

Route one leg from start to end, threading incoming (the direction already travelled) so the leg can’t double back. Read-only w.r.t. geometry — the graph is already closed, so the internal update() is a no-op. Returns the path points, the outgoing direction, and whether the lattice held a path at all.

Source

pub fn bump_leg(&mut self, path: &[Point], cost: Cost)

Add cost to every graph edge along the (axis-aligned) path, leg by leg.

Source

pub fn add_wire_cost(&mut self, a: Point, b: Point, cost: Cost)

Occupy the axis-aligned wire a → b by adding cost to each of the node-to-node graph edges it covers. Walks adjacency in the travel direction (edges are split at every node, so each hop is one graph edge). Never changes topology or sets dirty, so the graph stays closed and successors reads the new weights live on the next route.

Source

pub fn is_wire_blocked(&self, a: Point, b: Point) -> bool

Whether the axis-aligned wire a → b crosses any blocked rectangle.

Source

pub fn wire_hugs_block(&self, a: Point, b: Point) -> bool

Whether the straight wire a → b hugs any block (runs within the routing gutter alongside an edge). Complements Self::is_wire_blocked: together they decide whether a straight leg may be taken verbatim or must route around.

Source

pub fn is_accessible(&self, test: impl Into<Point>) -> bool

Source

pub fn debug_marks(&self) -> Vec<Mark>

Source

pub fn fingerprint(&self) -> Fingerprint

The lattice as a value that can be compared: every node, and every edge with its weight, in a canonical order. Two routers that fingerprint the same will route the same, whatever order they were assembled in — which is the property a cached background plus a replayed foreground has to hold against a whole build.

Trait Implementations§

Source§

impl Clone for ClosedRouter

Source§

fn clone(&self) -> ClosedRouter

Returns a duplicate 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 ClosedRouter

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

§

impl<T> Instrument for T

§

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

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

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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