VIEW_PROCESS

Struct 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_connected(&self) -> bool

View-process running, 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 info(&self) -> MappedRwLockReadGuard<'static, ViewProcessInfo>

Read lock view-process and reference current generation info.

Strongly recommend to clone/copy the info required, as the lock prevents info update on respawn.

Source

pub fn generation(&self) -> ViewProcessGen

Gets the current view-process generation.

Source

pub fn set_device_events_filter( &self, filter: DeviceEventsFilter, ) -> Result<(), ChannelError>

Enable/disable global device events.

This filter affects device events not targeted at windows, such as mouse move outside windows or key presses when the app has no focused window.

Source

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

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<(), ChannelError>

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 open_audio_output( &self, request: AudioOutputRequest, ) -> Result<(), ChannelError>

Send a request to open a connection to an audio output device.

A RAW_AUDIO_OUTPUT_OPEN_EVENT or RAW_AUDIO_OUTPUT_OPEN_ERROR_EVENT

Source

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

Send an image for decoding and caching.

This function returns immediately, the handle must be held and compared with the RAW_IMAGE_METADATA_DECODED_EVENT, RAW_IMAGE_DECODED_EVENT and RAW_IMAGE_DECODE_ERROR_EVENT events to receive the data.

Source

pub fn add_image_pro( &self, request: ImageRequest<IpcReceiver<IpcBytes>>, ) -> Result<ViewImageHandle, ChannelError>

Starts sending an image for progressive decoding and caching.

This function returns immediately, the handle must be held and compared with the RAW_IMAGE_METADATA_DECODED_EVENT, RAW_IMAGE_DECODED_EVENT and RAW_IMAGE_DECODE_ERROR_EVENT events to receive the data.

Source

pub fn encode_image( &self, request: ImageEncodeRequest, ) -> Receiver<Result<IpcBytes, EncodeError>>

Starts encoding an image.

The returned channel will update once with the result.

Source

pub fn add_audio( &self, request: AudioRequest<IpcBytes>, ) -> Result<ViewAudioHandle, ChannelError>

Send an audio for decoding and caching.

Depending on the request the audio may be decoded entirely or it may be decoded on demand.

This function returns immediately, the handle must be held and compared with the RAW_AUDIO_METADATA_DECODED_EVENT, RAW_AUDIO_DECODED_EVENT and RAW_AUDIO_DECODE_ERROR_EVENT events to receive the metadata and data.

Source

pub fn add_audio_pro( &self, request: AudioRequest<IpcReceiver<IpcBytes>>, ) -> Result<ViewAudioHandle, ChannelError>

Starts sending an audio for decoding and caching.

Depending on the request the audio may be decoded as it is received or it may be decoded on demand.

This function returns immediately, the handle must be held and compared with the RAW_AUDIO_METADATA_DECODED_EVENT, RAW_AUDIO_DECODED_EVENT and RAW_AUDIO_DECODE_ERROR_EVENT events to receive the metadata and data.

Source

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

View-process clipboard methods.

Source

pub fn notification_dialog( &self, notification: Var<Notification>, responder: ResponderVar<NotificationResponse>, ) -> Result<(), ChannelError>

Register a native notification, either a popup or an entry in the system notifications list.

If the notification var updates the notification content updates or closes.

If the notification is responded the responder variable is set.

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>, ChannelError>

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>, ChannelError>

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, ChannelError>

Call an extension with custom encoded payload.

Source

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

Call an extension with payload request.

Source

pub fn handle_disconnect(&self, vp_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,