Skip to main content

Reader

Struct Reader 

Source
pub struct Reader<'a> { /* private fields */ }
Expand description

The part as it is before one step, and the only way it is read: by a make, as of its own step, recording every read so that its node is made again when any of it changes — or by an editor, recording nothing: the part now (Part::current), or before or after one step of the last run (Part::before, Part::after), what that step is edited against and what scrubbing the timeline shows.

A target is read by its elements (ElementReference), never as a whole: a target meant to be read whole has a kind of element that is all of it (see HasElements).

A part placed in it is read by a reader of its own (Reader::placed_part), which records what it reads as read inside the placed part (Read::Inside). So is the part it is itself placed in, while it is built there — the path OUTSIDE, ..: a step of a part placed in an assembly reads a part placed beside it there as ../bracket, in context.

Implementations§

Source§

impl Reader<'_>

Source

pub fn shared<T: 'static>( &self, key: &'static str, make: impl FnOnce(&Reader<'_>) -> GeopResult<T>, ) -> GeopResult<Rc<T>>

What make makes of the part this reader reads, whole — a part placed, as Reader::placed_part reads it — made once for every reader of the part, with what make read recorded for each: every screw of a size, one build, is drawn once. key names what make makes: two makes of one key make the same of the same part. A reader of a part before one of its steps, or of a target being made, makes it each time.

Source§

impl<'a> Reader<'a>

Source

pub fn trying(&self, state: &'a StateValues) -> Reader<'a>

It as if its part were run at the state state, where that gives a value — /bolt:b.pose the state b.pose of the part placed as bolt — every target as its part built it: what a solve reads at every state it tries, without running the program again.

Only for what reads no target that itself read the state, which would be as built at the part’s own: a constraint’s make, which refuses any such read (see Reader::targets_reading_state).

Source

pub fn after_step(&self, step: &str) -> Reader<'a>

The same part after the step step of its last run, with what that step produced: what the step’s make read, as of the end of the step. The finished part for a step that did not run.

Source

pub fn seen(&self) -> Seen

What tells the part it reads from another (Seen): equal for two readers exactly when they see the same values — of one part or of two — so a view drawn of one is a view of the other: what an editor sends a viewer again only when it changed.

Source

pub fn recorded<T>(&self, read: impl FnOnce(&Reader<'_>) -> T) -> (T, Reads)

What read makes of the part it reads, and what of the part it read to make it: equal reads (Reader::reads_same) make it alike, so what an editor draws of a part is kept by what each drawer read, and drawn again only when that changed.

Source

pub fn reads_same(&self, reads: &Reads) -> bool

Whether everything reads read (Reader::recorded) reads the same through it.

Source

pub fn placed_in(self, outside: Reader<'a>) -> Self

The same, of a part placed in the part outside reads — as the step placing it reads that part (Part::placing): what it reads in context, through .., is read there. What an editor edits a step of a placed part against, where it is placed.

Source

pub fn revision(&self) -> u64

Changes exactly when a run changes any node of the part it reads (see Part::revision).

Source

pub fn previous<T: Clone + Default + 'static>(&self) -> GeopResult<T>

A copy of the target being made as the steps before left it: what a chain target (crate::target::Target::CHAIN) is produced from — the default, if no step produced it before. The read is recorded.

Source

pub fn retrieve_element<T: HasElements<K>, K: Kind>( &self, reference: &ElementReference<T, K>, ) -> GeopResult<T::Element<'a>>

The element reference names, of the part itself. One of a part placed in it is an error naming the instance: it is where that instance is, which Reader::retrieve_placed says.

Source

pub fn retrieve_placed<T: HasElements<K>, K: Kind>( &self, reference: &ElementReference<T, K>, ) -> GeopResult<InInstance<T::Element<'a>>>

The element reference names, of the part itself or of a part placed in it — however deep — as it is in its own part, with the instance’s path: where that is placed, the step that placed it says. The read is recorded inside the placed part.

Source

pub fn placed_part(&self, path: &str) -> GeopResult<Reader<'a>>

The part placed at path — bolt, or asm/bolt — as it was built, every read of it recorded as read inside it. .. (OUTSIDE) is the part it is placed in — ../bracket a part placed beside it — as the step placing it sees that part: only parts placed before it, so that no two parts read each other.

Source

pub fn outside(&self) -> GeopResult<(Reader<'a>, &'a str)>

The part the part it reads is placed in, as the step placing it reads it — every read of it recorded as read there, through .. — and the instance that step places it as. An error for a part built on its own, which no part places.

Source

pub fn instances(&self) -> Vec<&'a str>

The name of every part placed in the part it reads — not in those — in the order the steps placed them. The listing is recorded.

Source

pub fn retrieve_input(&self, name: &str) -> Option<Setting>

The input’s value, if the run gives one, the read recorded. An input behind an instance’s path — /bolt:d — is read inside the placed part.

Source

pub fn retrieve_state(&self, name: &str) -> StateValue

The state’s value; the default if the run gives none.

Source

pub fn given_state(&self, name: &str) -> Option<StateValue>

The state’s value, if the run gives one, the read recorded. A state behind an instance’s path — /bolt:b.pose — is the part’s own value of that name where it gives one: the value the placed part is built with. Else it is read inside the placed part — the placed program’s own, or none before a step placed it.

Source

pub fn reads_same_state(&self, reads: &Reads) -> bool

Whether every state reads read (Reader::recorded) reads the same through it — at the state it tries, if it tries one — in its part and in the parts placed in it. Only the state: of the same part, built once, as a solve reads it at every state it tries, nothing else read can have changed.

Source

pub fn has_read_state(&self, name: &str) -> bool

Whether it has read the state name: what a check of a value read from the state, a constraint’s derivatives, asks.

Source

pub fn targets_reading_state(&self) -> Vec<(Located, String)>

Every target the make it reads for read so far that itself read a state, directly or through what it read, with that state: what moves with the state without the make’s derivatives seeing it.

Source

pub fn defines<T>(&self, reference: &TargetReference<T>) -> bool

Whether a step before it produced reference, made or failed, the read recorded: what tells a target no step produced, which a collection reads as empty, from one that failed.

Source

pub fn targets_of<T: 'static>(&self) -> Vec<TargetReference<T>>

Every target it sees whose value is a T, in the order the steps produced them — of one step, by name: the sketches a step could pick, say, the newest last. Which there are is recorded.

Source

pub fn failed_targets_of<T: 'static>(&self) -> Vec<GeopError>

Why every target it sees that is produced to hold a T but failed did, in the order the steps produced them: what a question over all of them — every constraint of a part — cannot be answered without.

Source

pub fn read_file(&self, name: &str) -> GeopResult<(String, Rc<str>)>

The text of the file the program of the step being run names name, and its path. The read is recorded.

Source

pub fn read_bytes(&self, name: &str) -> GeopResult<(String, Rc<[u8]>)>

The bytes of the file the program of the step being run names name, and its path. The read is recorded.

Source

pub fn read_file_as<T: Serialize + DeserializeOwned + 'static>( &self, name: &str, kind: &'static str, make: impl FnOnce(&str) -> GeopResult<T>, ) -> GeopResult<(String, Rc<T>)>

What the file the program of the step being run names name reads as, as kind — a STEP file’s bodies — made of its text by make, and its path: made once for every build its workspace’s cache keeps it for (see crate::cache). The read is recorded.

Source

pub fn program(&self, name: &str) -> GeopResult<(Rc<Program>, Location)>

The program in the file the program of the step being run names name, and where it would be placed from there (see Runner::program). The read is recorded.

Trait Implementations§

Source§

impl<'a> Clone for Reader<'a>

Source§

fn clone(&self) -> Reader<'a>

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

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Reader<'a>

§

impl<'a> !Send for Reader<'a>

§

impl<'a> !Sync for Reader<'a>

§

impl<'a> !UnwindSafe for Reader<'a>

§

impl<'a> Freeze for Reader<'a>

§

impl<'a> Unpin for Reader<'a>

§

impl<'a> UnsafeUnpin for Reader<'a>

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.