pub struct ScriptViewHandle(/* private fields */);Implementations§
Source§impl ScriptViewHandle
impl ScriptViewHandle
pub fn view_id(&self) -> &str
pub fn state(&self) -> ScriptViewState
Sourcepub fn theme(&self) -> Result<ThemeHandle, ScriptViewError>
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.
Sourcepub fn theme_snapshot(&self, cx: &App) -> Result<ThemeSnapshot, ScriptViewError>
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.
Sourcepub fn select_theme(
&self,
family: &str,
variant: &str,
cx: &mut App,
) -> Result<bool, ScriptViewError>
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.
Sourcepub fn select_locale(
&self,
locale: &str,
cx: &mut App,
) -> Result<bool, ScriptViewError>
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.
Sourcepub fn set_motion_preference(
&self,
preference: MotionPreference,
cx: &mut App,
) -> Result<bool, ScriptViewError>
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.
Sourcepub fn root(&self, cx: &App) -> Result<Option<UiNode>, ScriptViewError>
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.
Sourcepub fn last_error(&self, cx: &App) -> Result<Option<String>, ScriptViewError>
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.
Sourcepub fn last_diagnostic(
&self,
cx: &App,
) -> Result<Option<Diagnostic>, ScriptViewError>
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.
Sourcepub fn take_performance_snapshot(
&self,
cx: &mut App,
) -> Result<ScriptViewPerformanceSnapshot, ScriptViewError>
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.
Sourcepub fn read_signal(
&self,
signal: &NativeSignal,
cx: &App,
) -> Result<SignalValue, ScriptViewError>
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.
Sourcepub fn write_signal(
&self,
signal: &NativeSignal,
value: SignalValue,
cx: &mut App,
) -> Result<bool, ScriptViewError>
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.
Sourcepub fn replace_native_collection(
&self,
name: &str,
collection: NativeCollection,
cx: &mut App,
) -> Result<bool, ScriptViewError>
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.
Sourcepub fn register_native_collection(
&self,
name: &str,
collection: NativeCollection,
cx: &mut App,
) -> Result<(), ScriptViewError>
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.
Sourcepub fn replace_native_text_document(
&self,
name: &str,
document: NativeTextDocument,
cx: &mut App,
) -> Result<bool, ScriptViewError>
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.
Sourcepub fn element(&self) -> Result<AnyElement, ScriptViewError>
pub fn element(&self) -> Result<AnyElement, ScriptViewError>
Return the measured embedding element.
§Errors
Returns ScriptViewError::DisposedView after explicit disposal.
Sourcepub fn flex_item(&self) -> Result<AnyElement, ScriptViewError>
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.
Sourcepub fn suspend(
&self,
window: &mut Window,
cx: &mut App,
) -> Result<bool, ScriptViewError>
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.
Sourcepub fn resume(&self, cx: &mut App) -> Result<bool, ScriptViewError>
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.
Sourcepub fn dispose(&self, cx: &mut App) -> Result<(), ScriptViewError>
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.
Sourcepub fn accessibility_snapshot(
&self,
cx: &App,
) -> Result<AccessibilityTree, ScriptViewError>
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.
Sourcepub fn automation_snapshot(
&self,
cx: &App,
) -> Result<AutomationSnapshot, ScriptViewError>
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.
Sourcepub fn automate(
&self,
command: AutomationCommand,
window: &mut Window,
cx: &mut App,
) -> Result<AutomationResult, ScriptViewError>
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.
Sourcepub fn reconcile_report(
&self,
cx: &App,
) -> Result<ReconcileReport, ScriptViewError>
pub fn reconcile_report( &self, cx: &App, ) -> Result<ReconcileReport, ScriptViewError>
Sourcepub fn focus_element(
&self,
reference: &ElementRef,
window: &mut Window,
cx: &mut App,
) -> Result<(), ScriptViewError>
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§
Auto Trait Implementations§
impl !RefUnwindSafe for ScriptViewHandle
impl !Send for ScriptViewHandle
impl !Sync for ScriptViewHandle
impl !UnwindSafe for ScriptViewHandle
impl Freeze for ScriptViewHandle
impl Unpin for ScriptViewHandle
impl UnsafeUnpin for ScriptViewHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Variant for T
impl<T> Variant for T
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Variant trait object to &mut dyn Any.Source§fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Variant trait object to Box<dyn Any>.