pub struct SceneTransaction<'a> { /* private fields */ }Expand description
An open transaction over a SceneModel: every edit until it drops is one
logical change.
Opened by SceneModel::transaction / SceneModel::user_edit. On drop it
closes the scope and — with an edit sink installed — delivers one
SceneTransactionRecord with the scene unborrowed.
Nesting joins: a guard opened while another is live adds no boundary, and
the outer stamp wins. Everything a guard says (squash, ephemeral,
abandon) therefore applies to the transaction it is part of, not to a
private one of its own.
Implementations§
Source§impl SceneTransaction<'_>
impl SceneTransaction<'_>
Sourcepub fn squash(self) -> Self
pub fn squash(self) -> Self
Coalesce this transaction’s repeated writes to one continuous quantity
— position, bounds, transform, opacity, z, placement — into a single
edit keeping the first old and the last new.
Off by default, and deliberately: squashing throws the intermediate
path away, which a replay, a presence indicator or a collaboration relay
needs, and losing it silently by default is exactly the quiet data loss
this seam exists to prevent. The built-in item drag already commits one
set_local_pos per gesture, so the default costs nothing in the common
case; a caller that writes per sample and wants endpoints asks for it.
Discrete edits — adds, removals, replacements, flags, parent changes — are never coalesced and keep their order.
Sourcepub fn ephemeral(self) -> Self
pub fn ephemeral(self) -> Self
Mark this transaction’s changes as per-frame artefacts: they must be rendered and must not be recorded.
The app-side half of the knob the scene’s own dynamic-bounds refresh
uses. An item whose transform follows a rotation Signal writes the
model every frame; without this, an app watching the change stream
cannot tell that churn from an edit. ephemeral rides every
SceneChange and the record, and the framework does nothing else with
it — what counts as history is the consumer’s call.
Sourcepub fn abandon(self)
pub fn abandon(self)
Mark the interaction cancelled, then commit.
The scene is not rolled back: applying an inverse is the first 80 %
of an undo stack, and undo lives on the other side of this seam. The
record arrives with TxnOutcome::Abandoned so the consumer can revert
from the old values it was handed without pushing anything a redo
could replay — tldraw’s bail, with the stack where it belongs.
On a nested guard this abandons the transaction it joined, because that is the transaction it is part of.
Trait Implementations§
Source§impl Debug for SceneTransaction<'_>
impl Debug for SceneTransaction<'_>
Source§impl Drop for SceneTransaction<'_>
impl Drop for SceneTransaction<'_>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for SceneTransaction<'a>
impl<'a> !Send for SceneTransaction<'a>
impl<'a> !Sync for SceneTransaction<'a>
impl<'a> !UnwindSafe for SceneTransaction<'a>
impl<'a> Freeze for SceneTransaction<'a>
impl<'a> Unpin for SceneTransaction<'a>
impl<'a> UnsafeUnpin for SceneTransaction<'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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more