Skip to main content

Pins

Struct Pins 

Source
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

Source

pub fn new() -> Self

An empty pin set.

Source

pub fn pin(&mut self, id: NodeId)

Pin id (script can still reach it). Idempotent.

Source

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).

Source

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.

Source

pub fn is_pinned(&self, id: NodeId) -> bool

Whether id is currently pinned.

Source

pub fn iter(&self) -> impl Iterator<Item = NodeId> + '_

The pinned ids — pass to ScriptedDom::collect as the extra roots.

Source

pub fn len(&self) -> usize

Number of pinned ids.

Source

pub fn is_empty(&self) -> bool

Whether nothing is pinned.

Source

pub fn clear(&mut self)

Drop every pin (document teardown).

Trait Implementations§

Source§

impl Clone for Pins

Source§

fn clone(&self) -> Pins

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pins

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Pins

Source§

fn default() -> Pins

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> MaybeSendSync for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.