Skip to main content

MutationObserver

Trait MutationObserver 

Source
pub trait MutationObserver<Ext>: 'static {
    // Required method
    fn observe(&mut self, dom: &mut Dom<Ext>, record: &Mutation);
}
Expand description

Observer callback trait. Receives a mutable &mut Dom<Ext> so observers can READ freely — but any attempt to mutate the tree inside observe() panics via the is_observing guard. Installing or removing observers from inside the callback is allowed (the web’s MutationObserver.disconnect() inside the callback): a removed observer — including the one currently running — receives nothing further; an added one receives only later records.

Required Methods§

Source

fn observe(&mut self, dom: &mut Dom<Ext>, record: &Mutation)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§