pub struct Pins { /* private fields */ }Expand description
A set of node ids to treat as extra mark roots for
ScriptedDom::collect — nodes the document tree no longer reaches but that
must survive anyway. The host pins a node while script can still reach it (it
holds a reflector), so a pinned orphan and its whole connected component are
spared; unpinning it makes it collectable. The DOM only sees a pin set; the
host’s word for these is “reflector pins” (it pins on minting a reflector
and retires the ones the engine reports dead). Engine-agnostic — it traffics
only in NodeId, naming no engine type.
Implementations§
Source§impl Pins
impl Pins
Sourcepub fn unpin(&mut self, id: NodeId) -> bool
pub fn unpin(&mut self, id: NodeId) -> bool
Drop the pin for id. Returns true if it had been pinned (an id never
pinned here is a harmless no-op).
Sourcepub fn retire_dead(&mut self, dead: impl IntoIterator<Item = NodeId>) -> usize
pub fn retire_dead(&mut self, dead: impl IntoIterator<Item = NodeId>) -> usize
Retire a batch of now-dead ids (the host maps the engine’s
drain_dead_reflectors output through NodeId::from_raw first),
unpinning each. Returns how many were actually pinned.
Sourcepub fn iter(&self) -> impl Iterator<Item = NodeId> + '_
pub fn iter(&self) -> impl Iterator<Item = NodeId> + '_
The pinned ids — pass to ScriptedDom::collect as the extra roots.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pins
impl RefUnwindSafe for Pins
impl Send for Pins
impl Sync for Pins
impl Unpin for Pins
impl UnsafeUnpin for Pins
impl UnwindSafe for Pins
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<T> ErasedDestructor for Twhere
T: 'static,
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