Struct zng_app::view_process::VIEW_PROCESS

source ·
pub struct VIEW_PROCESS;
Expand description

Connection to the running view-process for the context app.

Implementations§

source§

impl VIEW_PROCESS

source

pub fn is_available(&self) -> bool

If the VIEW_PROCESS can be used, this is only true in app threads for apps with render, all other methods will panic if called when this is not true.

source

pub fn is_online(&self) -> bool

View-process connected and ready.

source

pub fn is_headless_with_render(&self) -> bool

If is running in headless renderer mode.

source

pub fn is_same_process(&self) -> bool

If is running both view and app in the same process.

source

pub fn generation(&self) -> ViewProcessGen

Gets the current view-process generation.

source

pub fn open_window( &self, config: WindowRequest, ) -> Result<(), ViewProcessOffline>

Sends a request to open a window and associate it with the window_id.

A RAW_WINDOW_OPEN_EVENT or RAW_WINDOW_OR_HEADLESS_OPEN_ERROR_EVENT will be received in response to this request.

source

pub fn open_headless( &self, config: HeadlessRequest, ) -> Result<(), ViewProcessOffline>

Sends a request to open a headless renderer and associate it with the window_id.

Note that no actual window is created, only the renderer, the use of window-ids to identify this renderer is only for convenience.

A RAW_HEADLESS_OPEN_EVENT or RAW_WINDOW_OR_HEADLESS_OPEN_ERROR_EVENT will be received in response to this request.

source

pub fn add_image( &self, request: ImageRequest<IpcBytes>, ) -> Result<ViewImage, ViewProcessOffline>

Send an image for decoding.

This function returns immediately, the ViewImage will update when Event::ImageMetadataLoaded, Event::ImageLoaded and Event::ImageLoadError events are received.

source

pub fn add_image_pro( &self, request: ImageRequest<IpcBytesReceiver>, ) -> Result<ViewImage, ViewProcessOffline>

Starts sending an image for progressive decoding.

This function returns immediately, the ViewImage will update when Event::ImageMetadataLoaded, Event::ImagePartiallyLoaded, Event::ImageLoaded and Event::ImageLoadError events are received.

source

pub fn clipboard(&self) -> Result<&ViewClipboard, ViewProcessOffline>

View-process clipboard methods.

source

pub fn image_decoders(&self) -> Result<Vec<Txt>, ViewProcessOffline>

Returns a list of image decoders supported by the view-process backend.

Each string is the lower-case file extension.

source

pub fn image_encoders(&self) -> Result<Vec<Txt>, ViewProcessOffline>

Returns a list of image encoders supported by the view-process backend.

Each string is the lower-case file extension.

source

pub fn pending_frames(&self) -> usize

Number of frame send that have not finished rendering.

This is the sum of pending frames for all renderers.

source

pub fn respawn(&self)

Reopen the view-process, causing another Event::Inited.

source

pub fn extension_id( &self, extension_name: impl Into<ApiExtensionName>, ) -> Result<Option<ApiExtensionId>, ViewProcessOffline>

Gets the ID for the extension_name in the current view-process.

The ID can change for every view-process instance, you must subscribe to the VIEW_PROCESS_INITED_EVENT to refresh the ID. The view-process can respawn at any time in case of error.

source

pub fn third_party_licenses( &self, ) -> Result<Vec<LicenseUsed>, ViewProcessOffline>

Licenses that may be required to be displayed in the app about screen.

This is specially important for prebuilt view users, as the tools that scrap licenses may not find the prebuilt dependencies.

source

pub fn app_extension_raw( &self, extension_id: ApiExtensionId, extension_request: ApiExtensionPayload, ) -> Result<ApiExtensionPayload, ViewProcessOffline>

Call an extension with custom encoded payload.

source

pub fn app_extension<I, O>( &self, extension_id: ApiExtensionId, request: &I, ) -> Result<Result<O, ApiExtensionRecvError>, ViewProcessOffline>

Call an extension with payload request.

source

pub fn handle_disconnect(&self, gen: ViewProcessGen)

Handle an Event::Disconnected.

The process will exit if the view-process was killed by the user.

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

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> StateValue for T
where T: Any + Send + Sync,