Skip to main content

ScriptViewHandle

Struct ScriptViewHandle 

Source
pub struct ScriptViewHandle(/* private fields */);

Implementations§

Source§

impl ScriptViewHandle

Source

pub fn view_id(&self) -> &str

Source

pub fn state(&self) -> ScriptViewState

Source

pub fn theme(&self) -> Result<ThemeHandle, ScriptViewError>

Return a read-only, observable handle to this view’s effective theme.

§Errors

Returns ScriptViewError::DisposedView after explicit disposal.

Source

pub fn theme_snapshot(&self, cx: &App) -> Result<ThemeSnapshot, ScriptViewError>

Read this view’s latest effective theme without invoking Rhai.

§Errors

Returns ScriptViewError::DisposedView after explicit disposal.

Source

pub fn select_theme( &self, family: &str, variant: &str, cx: &mut App, ) -> Result<bool, ScriptViewError>

Select this view’s app-level theme from trusted Host code.

§Errors

Returns after disposal or when the requested theme is unavailable.

Source

pub fn select_locale( &self, locale: &str, cx: &mut App, ) -> Result<bool, ScriptViewError>

Select this view’s app-level locale from trusted Host code.

§Errors

Returns after disposal or when the requested locale is unavailable.

Source

pub fn set_motion_preference( &self, preference: MotionPreference, cx: &mut App, ) -> Result<bool, ScriptViewError>

Replace this view’s Host-owned motion preference without resetting state.

§Errors

Returns after disposal.

Source

pub fn root(&self, cx: &App) -> Result<Option<UiNode>, ScriptViewError>

Return the latest rendered declarative root.

§Errors

Returns ScriptViewError::DisposedView after disposal. Return the last successfully committed declarative tree.

A failed render deliberately preserves this last-good tree. Pair this method with Self::last_error when the caller must distinguish a current successful tree from a rollback after failure.

Source

pub fn last_error(&self, cx: &App) -> Result<Option<String>, ScriptViewError>

Return the latest mounted-view render, callback, delivery, or reload error.

Errors remain available while the last-good tree continues to render. A later successful script transaction clears the value; native-only repaint and animation frames do not.

§Errors

Returns ScriptViewError::DisposedView after disposal.

Source

pub fn last_diagnostic( &self, cx: &App, ) -> Result<Option<Diagnostic>, ScriptViewError>

Return structured details for the latest script runtime error.

Non-script host errors only have a string representation and return None here.

§Errors

Returns ScriptViewError::DisposedView after disposal.

Source

pub fn take_performance_snapshot( &self, cx: &mut App, ) -> Result<ScriptViewPerformanceSnapshot, ScriptViewError>

Drain execution timings and snapshot retained/virtual metrics.

§Errors

Returns ScriptViewError::DisposedView after disposal.

Source

pub fn read_signal( &self, signal: &NativeSignal, cx: &App, ) -> Result<SignalValue, ScriptViewError>

Read one mounted native hot value without invoking Rhai.

§Errors

Returns after disposal or when the signal is stale.

Source

pub fn write_signal( &self, signal: &NativeSignal, value: SignalValue, cx: &mut App, ) -> Result<bool, ScriptViewError>

Update one mounted native hot value on the GPUI foreground thread.

This repaints signal-bound properties without running a Rhai component.

§Errors

Returns after disposal or for stale/type-incompatible values.

Source

pub fn replace_native_collection( &self, name: &str, collection: NativeCollection, cx: &mut App, ) -> Result<bool, ScriptViewError>

Replace one registered Rust-owned collection on the GPUI foreground thread.

Only components that read this collection are marked dirty. The replacement is immutable and can be prepared away from the Rhai runtime.

§Errors

Returns after disposal or when the collection name is unknown.

Source

pub fn register_native_collection( &self, name: &str, collection: NativeCollection, cx: &mut App, ) -> Result<(), ScriptViewError>

Register a new Rust-owned collection on an already mounted view.

The name must not already exist. Registration marks the view root dirty; an active view rerenders on the next foreground cycle, while a suspended view consumes the collection when it resumes.

§Errors

Returns after disposal or for an unsafe/duplicate collection name.

Source

pub fn replace_native_text_document( &self, name: &str, document: NativeTextDocument, cx: &mut App, ) -> Result<bool, ScriptViewError>

Replace one registered Host-owned text document revision.

Only components that read this document are invalidated. The immutable text snapshot may be prepared on a background thread before publication.

§Errors

Returns after disposal or when the document name is unknown.

Source

pub fn element(&self) -> Result<AnyElement, ScriptViewError>

Return the measured embedding element.

§Errors

Returns ScriptViewError::DisposedView after explicit disposal.

Source

pub fn flex_item(&self) -> Result<AnyElement, ScriptViewError>

Return the measured view as a zero-basis, shrinkable host flex item.

Use this as the direct child of a Rust flex row or column. It prevents horizontally scrollable script content from contributing an automatic min-content width that expands the surrounding host layout.

§Errors

Returns ScriptViewError::DisposedView after explicit disposal.

Source

pub fn suspend( &self, window: &mut Window, cx: &mut App, ) -> Result<bool, ScriptViewError>

Quiesce this retained view without discarding script or native UI state.

§Errors

Returns after disposal or when a suspend hook/effect cleanup fails.

Source

pub fn resume(&self, cx: &mut App) -> Result<bool, ScriptViewError>

Atomically resume a suspended view before returning it to Host layout.

§Errors

Returns after disposal or when pending delivery, resume hook, reload, or the first restored render fails. A compensable failure leaves the view suspended; failed compensation disposes and quarantines the view.

Source

pub fn dispose(&self, cx: &mut App) -> Result<(), ScriptViewError>

Dispose this view immediately. The operation is idempotent.

§Errors

Returns an entity update error only if GPUI has already released the underlying view unexpectedly.

Source

pub fn focus( &self, window: &mut Window, cx: &mut App, ) -> Result<(), ScriptViewError>

Focus this view’s stable root handle.

§Errors

Returns ScriptViewError::DisposedView after disposal.

Source

pub fn accessibility_snapshot( &self, cx: &App, ) -> Result<AccessibilityTree, ScriptViewError>

Snapshot the retained semantic tree and last committed geometry.

§Errors

Returns after disposal or for an invalid retained semantic graph.

Source

pub fn automation_snapshot( &self, cx: &App, ) -> Result<AutomationSnapshot, ScriptViewError>

Snapshot the stable language-neutral automation tree.

§Errors

Returns after disposal or for an invalid retained semantic graph.

Source

pub fn automate( &self, command: AutomationCommand, window: &mut Window, cx: &mut App, ) -> Result<AutomationResult, ScriptViewError>

Execute one automation command on the GPUI foreground thread.

Dispatch and action commands use the mounted production handlers; deterministic time advance requires an injected controllable clock.

§Errors

Returns after disposal, for locator/command failures, or runtime errors.

Source

pub fn reconcile_report( &self, cx: &App, ) -> Result<ReconcileReport, ScriptViewError>

Return the last successfully committed retained diff report.

§Errors

Returns after disposal.

Source

pub fn focus_element( &self, reference: &ElementRef, window: &mut Window, cx: &mut App, ) -> Result<(), ScriptViewError>

Focus a mounted retained element without invoking Rhai.

§Errors

Returns after disposal, for a stale ref, or when the ref has no active GPUI focus handle.

Trait Implementations§

Source§

impl Clone for ScriptViewHandle

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

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> 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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

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

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Variant for T
where T: Any + Clone + SendSync,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert this Variant trait object to &dyn Any.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert this Variant trait object to &mut dyn Any.
Source§

fn as_boxed_any(self: Box<T>) -> Box<dyn Any>

Convert this Variant trait object to Box<dyn Any>.
Source§

fn type_name(&self) -> &'static str

Get the name of this type.
Source§

fn clone_object(&self) -> Box<dyn Variant>

Clone this Variant trait object.
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