Skip to main content

Hooks

Trait Hooks 

Source
pub trait Hooks: Send + Sync {
    // Provided methods
    fn on_people(&self, _room: &ViewRoom) { ... }
    fn on_reload(&self, _room: &ViewRoom) { ... }
    fn on_saved(&self, _room: &ViewRoom) { ... }
    fn on_closed(&self, _room: &ViewRoom) { ... }
}
Expand description

File room hooks. Every method defaults to a no-op, like the optional members of the TypeScript Hooks object.

Provided Methods§

Source

fn on_people(&self, _room: &ViewRoom)

Someone joined or left, or moved their pointer or selection.

Source

fn on_reload(&self, _room: &ViewRoom)

The file changed outside the room, or the room reconnected. Editable kinds get a new doc to rebind to; others reload the file.

Source

fn on_saved(&self, _room: &ViewRoom)

The room’s edits were written back to the file.

Source

fn on_closed(&self, _room: &ViewRoom)

The room ended: it closed, or no longer lets you in. A dropped connection reconnects on its own.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Hooks for ()

Implementors§