Skip to main content

PlanTree

Struct PlanTree 

Source
pub struct PlanTree { /* private fields */ }

Implementations§

Source§

impl PlanTree

Source

pub fn build(rows: Vec<RoadmapRow>) -> Result<PlanTree, AxError>

Places every row and works out what each one is worth.

§Errors

Fail-closed, in the same shape as crate::locator: a plan that cannot be read is refused rather than guessed at, because every progress figure in the city is divided by it. Five refusals — a repeated index, a node whose parent is missing, a dependency on a node that is not there, a dependency in a circle, and a branch marked done over a child that is not.

Source

pub fn get(&self, id: &NodeId) -> Option<&PlanNode>

Source

pub fn nodes(&self) -> impl Iterator<Item = &PlanNode>

Every node, in table order.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn needs_of(&self, id: &NodeId) -> BTreeSet<NodeId>

What a node waits for, including everything its ancestors wait for. A child of a branch that is waiting is waiting too; answering otherwise would let 2.3.1 start while the reason 2.3 cannot start is still unresolved.

Source

pub fn ready(&self) -> Vec<NodeId>

What may be started right now: leaves nobody has taken, whose dependencies — their own and their branch’s — are all done.

Pure, and that is the point: a city with no ready nodes and nothing running has finished, and a stop condition that depended on I/O could not be trusted to say so.

Source

pub fn claim(&self, id: &NodeId) -> Result<Held, AxError>

Takes a node to work on.

§Errors

Refuses everything Self::ready leaves out, and says which of the three reasons applies: the index is not in the table, the node is a branch or already taken, or it is still waiting on something. The third names what it waits for, because “no” sends a model round the loop again while “1.4 is not done” does not.

Source

pub fn progress(&self) -> Progress

The plan’s own reading of itself: leaves counted, and the share of the whole those leaves carry.

Both figures travel because they answer different questions and mislead alone. A share says how much of the plan is behind you; a leaf count says how many pieces the plan turned out to have, and it is the figure that does not move when somebody divides their own branch generously.

Trait Implementations§

Source§

impl Clone for PlanTree

Source§

fn clone(&self) -> Self

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 PlanTree

Source§

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

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

impl Eq for PlanTree

Source§

impl PartialEq for PlanTree

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PlanTree

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.