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
impl VIEW_PROCESS
sourcepub fn is_available(&self) -> bool
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.
sourcepub fn is_headless_with_render(&self) -> bool
pub fn is_headless_with_render(&self) -> bool
If is running in headless renderer mode.
sourcepub fn is_same_process(&self) -> bool
pub fn is_same_process(&self) -> bool
If is running both view and app in the same process.
sourcepub fn generation(&self) -> ViewProcessGen
pub fn generation(&self) -> ViewProcessGen
Gets the current view-process generation.
sourcepub fn open_window(
&self,
config: WindowRequest,
) -> Result<(), ViewProcessOffline>
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.
sourcepub fn open_headless(
&self,
config: HeadlessRequest,
) -> Result<(), ViewProcessOffline>
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.
sourcepub fn add_image(
&self,
request: ImageRequest<IpcBytes>,
) -> Result<ViewImage, ViewProcessOffline>
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.
sourcepub fn add_image_pro(
&self,
request: ImageRequest<IpcBytesReceiver>,
) -> Result<ViewImage, ViewProcessOffline>
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.
sourcepub fn clipboard(&self) -> Result<&ViewClipboard, ViewProcessOffline>
pub fn clipboard(&self) -> Result<&ViewClipboard, ViewProcessOffline>
View-process clipboard methods.
sourcepub fn image_decoders(&self) -> Result<Vec<Txt>, ViewProcessOffline>
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.
sourcepub fn image_encoders(&self) -> Result<Vec<Txt>, ViewProcessOffline>
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.
sourcepub fn pending_frames(&self) -> usize
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.
sourcepub fn respawn(&self)
pub fn respawn(&self)
Reopen the view-process, causing another Event::Inited
.
sourcepub fn extension_id(
&self,
extension_name: impl Into<ApiExtensionName>,
) -> Result<Option<ApiExtensionId>, ViewProcessOffline>
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.
sourcepub fn third_party_licenses(
&self,
) -> Result<Vec<LicenseUsed>, ViewProcessOffline>
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.
sourcepub fn app_extension_raw(
&self,
extension_id: ApiExtensionId,
extension_request: ApiExtensionPayload,
) -> Result<ApiExtensionPayload, ViewProcessOffline>
pub fn app_extension_raw( &self, extension_id: ApiExtensionId, extension_request: ApiExtensionPayload, ) -> Result<ApiExtensionPayload, ViewProcessOffline>
Call an extension with custom encoded payload.
sourcepub fn app_extension<I, O>(
&self,
extension_id: ApiExtensionId,
request: &I,
) -> Result<Result<O, ApiExtensionRecvError>, ViewProcessOffline>where
I: Serialize,
O: DeserializeOwned,
pub fn app_extension<I, O>(
&self,
extension_id: ApiExtensionId,
request: &I,
) -> Result<Result<O, ApiExtensionRecvError>, ViewProcessOffline>where
I: Serialize,
O: DeserializeOwned,
Call an extension with payload request
.
sourcepub fn handle_disconnect(&self, gen: ViewProcessGen)
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§
impl Freeze for VIEW_PROCESS
impl RefUnwindSafe for VIEW_PROCESS
impl Send for VIEW_PROCESS
impl Sync for VIEW_PROCESS
impl Unpin for VIEW_PROCESS
impl UnwindSafe for VIEW_PROCESS
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more