Skip to main content

BrowserHost

Trait BrowserHost 

Source
pub trait BrowserHost: Send + Sync {
Show 20 methods // Required methods fn call<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, tool: &'life2 str, args: Value, ) -> Pin<Box<dyn Future<Output = Result<Vec<BrowserPart>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn attach<'life0, 'life1, 'async_trait>( &'life0 self, viewer: u64, seat: &'life1 SessionSlot, tab: Option<u16>, ) -> Pin<Box<dyn Future<Output = Result<BrowserAttachment, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn detach<'life0, 'async_trait>( &'life0 self, viewer: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn input<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, viewer: u64, seq: u64, event: &'life2 BrowserInputEvent, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn answer_files<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, id: u64, files: Vec<BrowserUpload>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn take_control<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, viewer: u64, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn resize<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, viewer: u64, width: u32, height: u32, scale: f64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn release_control<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, viewer: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn nav<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, viewer: u64, back: bool, ) -> Pin<Box<dyn Future<Output = Result<BrowserNavState, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn nav_state<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, ) -> Pin<Box<dyn Future<Output = Option<BrowserNavState>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn tabs<'life0, 'life1, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = Result<BrowserTabList, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn tab_stream<'life0, 'life1, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = Result<Receiver<BrowserTabList>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn sweep_sessions<'life0, 'life1, 'async_trait>( &'life0 self, seats: &'life1 [SessionSlot], generation: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn replace_seat<'life0, 'life1, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn session_ended(&self, seat: &SessionSlot); fn hand_off_started<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, target: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<u16, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn hand_off_finished<'life0, 'life1, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, tab: u16, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn warm<'life0, 'life1, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided method fn attach_page<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _viewer: u64, _seat: &'life1 SessionSlot, _target: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<BrowserAttachment, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... }
}
Expand description

The server’s browser fleet, as the workspace calls it.

Required Methods§

Source

fn call<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, tool: &'life2 str, args: Value, ) -> Pin<Box<dyn Future<Output = Result<Vec<BrowserPart>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Run one browser tool through the tab the calling session drives.

Source

fn attach<'life0, 'life1, 'async_trait>( &'life0 self, viewer: u64, seat: &'life1 SessionSlot, tab: Option<u16>, ) -> Pin<Box<dyn Future<Output = Result<BrowserAttachment, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Attach a viewer to one of the seat’s tabs. tab is None for the seat’s current tab, else its profile’s first.

The attach moves the viewer, and the role with it: a same-tab attach by the viewer already there keeps the controller role it holds there, and any other attach (another tab, another profile) releases what it held on the one it leaves. An implementation that detaches the viewer first turns every re-attach into a move and takes the role with it, which is the silent failure this rule exists to prevent.

Source

fn detach<'life0, 'async_trait>( &'life0 self, viewer: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

A viewer’s connection ended.

Source

fn input<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, viewer: u64, seq: u64, event: &'life2 BrowserInputEvent, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

One input event, only from the viewer that holds the role on that tab.

Source

fn answer_files<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, id: u64, files: Vec<BrowserUpload>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Answer a page’s file chooser: the files a person chose, or none.

Source

fn take_control<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, viewer: u64, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Give viewer the controller role on one tab.

Source

fn resize<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, viewer: u64, width: u32, height: u32, scale: f64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Lay one tab out to the controller’s surface: device pixels and the ratio they draw at. Only the controller’s size applies; a watcher’s window does not move the page under the person driving it.

Source

fn release_control<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, viewer: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Release the role, when this viewer still holds it on that tab.

Source

fn nav<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, viewer: u64, back: bool, ) -> Pin<Box<dyn Future<Output = Result<BrowserNavState, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Move one tab through its history, answering where it now sits. Only the controller moves the page: a watcher’s move would move it under the person driving it.

Source

fn nav_state<'life0, 'life1, 'async_trait>( &'life0 self, profile: &'life1 str, tab: u16, ) -> Pin<Box<dyn Future<Output = Option<BrowserNavState>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Where one tab’s history sits, when the browser can answer.

Source

fn tabs<'life0, 'life1, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = Result<BrowserTabList, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A seat’s tabs as its strip draws them.

Source

fn tab_stream<'life0, 'life1, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = Result<Receiver<BrowserTabList>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A stream of a seat’s tab rows, for a strip that follows them.

Source

fn sweep_sessions<'life0, 'life1, 'async_trait>( &'life0 self, seats: &'life1 [SessionSlot], generation: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The seats that remain: a tab whose session is gone is closed, except a tab a parked hand-off holds. Called when a seat is torn down. generation orders captures (LiveSeats): a sweep at or below the last applied one is dropped, so a stale snapshot cannot re-admit an ended seat.

Source

fn replace_seat<'life0, 'life1, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A /new or /resume: the slot stays and the previous occupant’s tabs close, except a tab a parked hand-off holds.

Source

fn session_ended(&self, seat: &SessionSlot)

The seat has ended, as opposed to a sweep’s guess: the fleet must answer a hand-off resolution from this fact, so a closed lead’s held tab does not survive Done. Synchronous, so it lands before the close work that follows it. A successor clears it by warming or calling.

Source

fn hand_off_started<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, target: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<u16, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

A hand-off parked on one of the seat’s pages, named by the page id its listing printed: the tab is held against the sweep and the idle clock until it resolves. Answers the tab number the ask raises. Refused when no tab has that page or it is not this seat’s, before any ask reaches a person.

Source

fn hand_off_finished<'life0, 'life1, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, tab: u16, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A hand-off left the registry: the tab is released, and a session that went while it was held takes its tab with it.

Source

fn warm<'life0, 'life1, 'async_trait>( &'life0 self, seat: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create the seat’s profile entry and start its host, with no tab. The first seat of a profile calls it at spawn; later seats reuse the host.

Source

fn stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

End every open browser and its driver, keeping the profiles on disk. The hosts are the server’s children, so a clean stop ends them; a profile’s logins stay, and no tab survives a host - the next boot’s first call opens a fresh tab. Answers the profiles whose host outlived the teardown, named, so a stop that leaves a process behind cannot report success.

Provided Methods§

Source

fn attach_page<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _viewer: u64, _seat: &'life1 SessionSlot, _target: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<BrowserAttachment, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Attach to the tab a page target names, for a hand-off that outlived the host which minted its number.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§