Skip to main content

WebPresenter

Struct WebPresenter 

Source
pub struct WebPresenter { /* private fields */ }
Expand description

WASM presenter that captures buffers and logs for the host.

Implementations§

Source§

impl WebPresenter

Source

pub fn new() -> Self

Create a new presenter with modern capabilities.

Source

pub fn with_size(width: u16, height: u16) -> Self

Create a new presenter with explicit initial dimensions.

Source

pub const fn outputs(&self) -> &WebOutputs

Get captured outputs.

Source

pub fn outputs_mut(&mut self) -> &mut WebOutputs

Mutably access captured outputs.

Source

pub fn take_outputs(&mut self) -> WebOutputs

Take captured outputs, leaving empty defaults.

Source

pub const fn pool(&self) -> &GraphemePool

Reference to the grapheme pool.

Source

pub fn pool_mut(&mut self) -> &mut GraphemePool

Mutably access the grapheme pool.

Reference to the link registry.

Mutably access the link registry.

Source

pub const fn width(&self) -> u16

Current width of the presenter.

Source

pub const fn height(&self) -> u16

Current height of the presenter.

Source

pub fn flatten_patches_into(&self, cells: &mut Vec<u32>, spans: &mut Vec<u32>)

Flatten patch runs into caller-provided reusable buffers.

Clears and refills the provided cells and spans Vecs, reusing their heap capacity across frames to avoid per-frame allocation.

Source

pub fn present_ui_owned( &mut self, buf: Buffer, diff: Option<&BufferDiff>, full_repaint_hint: bool, )

Present a frame, taking ownership of the buffer to avoid cloning.

This is the zero-copy fast path for callers that can give up ownership (e.g. StepProgram::render_frame). The buffer is moved directly into last_buffer instead of being cloned.

Trait Implementations§

Source§

impl BackendPresenter for WebPresenter

Source§

type Error = WebBackendError

Platform-specific error type.
Source§

fn capabilities(&self) -> &TerminalCapabilities

Terminal capabilities detected by this backend.
Source§

fn write_log(&mut self, text: &str) -> Result<(), Self::Error>

Write a log line to the scrollback region (inline mode) or stderr.
Source§

fn resize(&mut self, cols: u16, rows: u16)

Resize the presentation surface.
Source§

fn screen_mode(&self) -> ScreenMode

Current screen mode.
Source§

fn set_screen_mode(&mut self, mode: ScreenMode)

Set screen mode.
Mutably borrow the grapheme pool and link registry.
Source§

fn pool_mut(&mut self) -> &mut GraphemePool

Mutably borrow the grapheme pool.
Source§

fn present_ui( &mut self, buf: &Buffer, diff: Option<&BufferDiff>, full_repaint_hint: bool, ) -> Result<(), Self::Error>

Present a UI frame. Read more
Source§

fn present_ui_owned( &mut self, buf: Buffer, cursor: Option<(u16, u16)>, cursor_visible: bool, ) -> Result<(), Self::Error>

Present a UI frame, taking ownership of the buffer.
Source§

fn gc(&mut self)

Optional: release resources held by the presenter (e.g., grapheme pool compaction).
Source§

fn notify_resize(&mut self, _cols: u16, _rows: u16)

Notify the presenter immediately when a resize event arrives, before resize coalescing defers the frame redraw.
Source§

fn set_evidence_writer(&mut self, _w: Option<Arc<dyn Fn(&str) + Sync + Send>>)

Configure an evidence-writer callback.
Source§

fn last_diff_strategy(&self) -> Option<DiffStrategy>

Last diff strategy used, if any.
Source§

fn last_diff_elapsed(&self) -> Option<Duration>

Last diff elapsed duration, if any.
Source§

fn begin_shutdown(&mut self) -> Result<(), Self::Error>

Begin shutting down the presenter.
Source§

fn flush(&mut self) -> Result<(), Self::Error>

Flush any pending output to the terminal or host.
Source§

fn suspend(&mut self) -> Result<(), Self::Error>

Release presenter-owned terminal state ahead of a job-control stop: close an open synchronized-output block, reset the scroll region, show the cursor. On resume the runtime calls resize, which must drop any diff baseline, since the screen is no longer ours.
Source§

fn take_render_buffer(&mut self, width: u16, height: u16) -> Buffer

Take a reusable render buffer sized for the current frame.
Mark the beginning of a frame for hyperlink tracking.
Source§

fn inline_auto_bounds(&self) -> Option<(u16, u16)>

Configured bounds for inline auto mode, if active.
Source§

fn auto_ui_height(&self) -> Option<u16>

Current measured or auto-determined UI height for inline auto mode.
Source§

fn render_height_hint(&self) -> u16

Height hint to use when rendering a frame.
Source§

fn set_auto_ui_height(&mut self, _height: u16)

Set auto UI height for inline auto mode.
Source§

fn clear_auto_ui_height(&mut self)

Clear auto UI height for inline auto mode.
Source§

fn take_last_present_timings(&mut self) -> Option<PresentTimings>

Take presentation timings from the last rendered frame, if recorded.
Source§

fn estimate_memory_usage(&self) -> usize

Estimate memory usage of buffers and pools held by the presenter.
Source§

fn write_log_line_with_mode( &mut self, text: &str, _mode: SanitizeMode, ) -> Result<(), Self::Error>

Write a log line with a specific sanitization mode.
Source§

fn write_osc52_set( &mut self, _selection: ClipboardSelection, _data: &[u8], ) -> Result<(), Self::Error>

Write an OSC 52 set clipboard sequence.
Source§

fn write_osc52_query( &mut self, _selection: ClipboardSelection, ) -> Result<(), Self::Error>

Write an OSC 52 query clipboard sequence.
Source§

fn set_timing_enabled(&mut self, _enabled: bool)

Enable or disable presentation timing measurements.
Set hyperlink limit for tracking.
Source§

impl Clone for WebPresenter

Source§

fn clone(&self) -> Self

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 WebPresenter

Source§

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

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

impl Default for WebPresenter

Source§

fn default() -> Self

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

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more