pub struct History { /* private fields */ }Expand description
A record of what one operation, or a chain of them, did.
Keyed by SameKey: node and placement, ignoring orientation. An edge and
its reverse are the same edge, and history about one is history about both;
keying on orientation would silently split every record in two.
Implementations§
Source§impl History
impl History
Sourcepub fn identity() -> Self
pub fn identity() -> Self
A history in which nothing happened to anything.
The identity for History::then: composing with it changes nothing.
Sourcepub fn generate(&mut self, input: &Shape, output: Shape)
pub fn generate(&mut self, input: &Shape, output: Shape)
Record that input produced output as a new entity.
Sourcepub fn modify(&mut self, input: &Shape, output: Shape)
pub fn modify(&mut self, input: &Shape, output: Shape)
Record that input became output.
Withdraws any deletion recorded for the same shape. Deletion and modification are contradictory claims, and the guard has to run both ways: clearing modifications on delete but not deletions on modify leaves a history that says both, and two callers reach opposite conclusions from it.
Sourcepub fn delete(&mut self, input: &Shape)
pub fn delete(&mut self, input: &Shape)
Record that input has no image in the result.
A shape cannot be both deleted and modified: if it became something, it was not deleted. Recording a deletion drops any modification record for the same shape, so the two can never disagree.
Deletion and generation are a different matter, and coexist freely: a swept profile edge is consumed by the sweep (deleted) while generating the side face that grew from it. Anything that treats a deletion as the end of the story about a shape loses that face’s ancestry.
Sourcepub fn modified(&self, input: &Shape) -> &[Shape]
pub fn modified(&self, input: &Shape) -> &[Shape]
What input became.
Empty for a shape the operation left alone: “unchanged” and “modified
into nothing” are different, and the second is History::is_deleted.
Sourcepub fn is_deleted(&self, input: &Shape) -> bool
pub fn is_deleted(&self, input: &Shape) -> bool
Whether input has no image in the result.
Sourcepub fn is_affected(&self, input: &Shape) -> bool
pub fn is_affected(&self, input: &Shape) -> bool
Whether the operation touched input at all.
Sourcepub fn trace<'a>(&'a self, input: &'a Shape) -> &'a [Shape]
pub fn trace<'a>(&'a self, input: &'a Shape) -> &'a [Shape]
Where input ended up: what it became, or itself if it was untouched.
The question a caller resolving a stored reference actually has. A shape an operation ignored is still there, and reporting nothing for it would make every caller special-case the common path.
Returns an empty slice only for a shape that was deleted.
Sourcepub fn then(&self, later: &Self) -> Self
pub fn then(&self, later: &Self) -> Self
This history followed by later.
Composition, and the operation everything chained depends on. For each shape either history knows about, the result answers where it ended up after both steps.
The subtlety is telling unchanged from modified into itself. A shape neither step touched must come out with no record at all, not a modification saying it became itself; otherwise composing with an empty history would invent records, and composition would not have an identity. So a modification is recorded only when one of the two steps actually reported one.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for History
impl RefUnwindSafe for History
impl Send for History
impl Sync for History
impl Unpin for History
impl UnsafeUnpin for History
impl UnwindSafe for History
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.