pub struct Overlay<'a> {
pub base: &'a Document,
pub entities: BTreeMap<EntityId, Option<Entity>>,
pub constraints: BTreeMap<ConstraintId, Option<Constraint>>,
pub groups: BTreeMap<GroupId, Option<Group>>,
pub layers: Option<Vec<Layer>>,
pub settings: Option<Settings>,
pub order_ops: Vec<OrderOp>,
pub next_id: u64,
}Expand description
Copy-on-write overlay over a document used while a transaction runs.
Fields§
§base: &'a DocumentBase document.
entities: BTreeMap<EntityId, Option<Entity>>Changed entities (None = deleted).
constraints: BTreeMap<ConstraintId, Option<Constraint>>Changed constraints.
groups: BTreeMap<GroupId, Option<Group>>Changed groups.
layers: Option<Vec<Layer>>Replaced layer list.
settings: Option<Settings>Replaced settings.
order_ops: Vec<OrderOp>Draw-order operations.
next_id: u64ID allocator.
Implementations§
Source§impl<'a> Overlay<'a>
impl<'a> Overlay<'a>
Sourcepub fn entity_mut(&mut self, id: EntityId) -> Option<&mut Entity>
pub fn entity_mut(&mut self, id: EntityId) -> Option<&mut Entity>
Entity for modification (copied into the overlay on first write).
Sourcepub fn put_entity(&mut self, e: Entity)
pub fn put_entity(&mut self, e: Entity)
Insert or replace an entity.
Sourcepub fn delete_entity(&mut self, id: EntityId)
pub fn delete_entity(&mut self, id: EntityId)
Delete an entity.
Sourcepub fn put_constraint(&mut self, c: Constraint)
pub fn put_constraint(&mut self, c: Constraint)
Insert or replace a constraint.
Sourcepub fn delete_constraint(&mut self, id: ConstraintId)
pub fn delete_constraint(&mut self, id: ConstraintId)
Delete a constraint.
Sourcepub fn layers_mut(&mut self) -> &mut Vec<Layer>
pub fn layers_mut(&mut self) -> &mut Vec<Layer>
Layers (copied on first write).
Sourcepub fn settings_mut(&mut self) -> &mut Settings
pub fn settings_mut(&mut self) -> &mut Settings
Settings for modification.
Sourcepub fn constraint_ids(&self) -> Vec<ConstraintId>
pub fn constraint_ids(&self) -> Vec<ConstraintId>
All constraint IDs visible in the overlay (base ∪ new − deleted).
Sourcepub fn entity_ids(&self) -> Vec<EntityId>
pub fn entity_ids(&self) -> Vec<EntityId>
All entity IDs visible in the overlay.
Trait Implementations§
Source§impl DocView for Overlay<'_>
impl DocView for Overlay<'_>
Source§fn constraint(&self, id: ConstraintId) -> Option<&Constraint>
fn constraint(&self, id: ConstraintId) -> Option<&Constraint>
Constraint by ID.
Auto Trait Implementations§
impl<'a> Freeze for Overlay<'a>
impl<'a> RefUnwindSafe for Overlay<'a>
impl<'a> Send for Overlay<'a>
impl<'a> Sync for Overlay<'a>
impl<'a> Unpin for Overlay<'a>
impl<'a> UnsafeUnpin for Overlay<'a>
impl<'a> UnwindSafe for Overlay<'a>
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
Mutably borrows from an owned value. Read more
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.