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<'_>
impl Reader<'_>
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>
impl<'a> Reader<'a>
Sourcepub fn trying(&self, state: &'a StateValues) -> Reader<'a>
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).
Sourcepub fn after_step(&self, step: &str) -> Reader<'a>
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.
Sourcepub fn seen(&self) -> Seen
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.
Sourcepub fn recorded<T>(&self, read: impl FnOnce(&Reader<'_>) -> T) -> (T, Reads)
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.
Sourcepub fn reads_same(&self, reads: &Reads) -> bool
pub fn reads_same(&self, reads: &Reads) -> bool
Whether everything reads read (Reader::recorded) reads the
same through it.
Sourcepub fn placed_in(self, outside: Reader<'a>) -> Self
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.
Sourcepub fn revision(&self) -> u64
pub fn revision(&self) -> u64
Changes exactly when a run changes any node of the part it reads
(see Part::revision).
Sourcepub fn previous<T: Clone + Default + 'static>(&self) -> GeopResult<T>
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.
Sourcepub fn retrieve_element<T: HasElements<K>, K: Kind>(
&self,
reference: &ElementReference<T, K>,
) -> GeopResult<T::Element<'a>>
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.
Sourcepub fn retrieve_placed<T: HasElements<K>, K: Kind>(
&self,
reference: &ElementReference<T, K>,
) -> GeopResult<InInstance<T::Element<'a>>>
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.
Sourcepub fn placed_part(&self, path: &str) -> GeopResult<Reader<'a>>
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.
Sourcepub fn outside(&self) -> GeopResult<(Reader<'a>, &'a str)>
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.
Sourcepub fn instances(&self) -> Vec<&'a str>
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.
Sourcepub fn retrieve_input(&self, name: &str) -> Option<Setting>
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.
Sourcepub fn retrieve_state(&self, name: &str) -> StateValue
pub fn retrieve_state(&self, name: &str) -> StateValue
The state’s value; the default if the run gives none.
Sourcepub fn given_state(&self, name: &str) -> Option<StateValue>
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.
Sourcepub fn reads_same_state(&self, reads: &Reads) -> bool
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.
Sourcepub fn has_read_state(&self, name: &str) -> bool
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.
Sourcepub fn targets_reading_state(&self) -> Vec<(Located, String)>
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.
Sourcepub fn defines<T>(&self, reference: &TargetReference<T>) -> bool
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.
Sourcepub fn targets_of<T: 'static>(&self) -> Vec<TargetReference<T>>
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.
Sourcepub fn failed_targets_of<T: 'static>(&self) -> Vec<GeopError>
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.
Sourcepub fn read_file(&self, name: &str) -> GeopResult<(String, Rc<str>)>
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.
Sourcepub fn read_bytes(&self, name: &str) -> GeopResult<(String, Rc<[u8]>)>
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.
Sourcepub fn read_file_as<T: Serialize + DeserializeOwned + 'static>(
&self,
name: &str,
kind: &'static str,
make: impl FnOnce(&str) -> GeopResult<T>,
) -> GeopResult<(String, Rc<T>)>
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.
Sourcepub fn program(&self, name: &str) -> GeopResult<(Rc<Program>, Location)>
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.