Skip to main content
QAROS Rust API Dev (main) · versions: Dev (main) · Developer Guide

Runtime

Struct Runtime 

Source
pub struct Runtime { /* private fields */ }
Expand description

A QarRuntime. Sessions keep it alive; it is released after the last of them (qar_runtime_handle_destroy), which ends its pending async onboards and rejoins and waits for their callbacks.

Implementations§

Source§

impl Runtime

Source

pub fn create_member_hub_invitation( &self, config: &MemberHubInvitationConfig, cancel: Option<&CancelToken>, ) -> Result<MemberHubInvitation>

Asks the QAROS hub on this PC, the session’s primary hub, for a member-hub invitation (qar_runtime_create_member_hub_invitation). Needs no session: the hub identifies this process as for a local app, and answers only an application it approved with the right to bring in member hubs and with quota left (spent per hub the invitation admits, not per invitation). It never prompts. The C call takes a cancel token but no progress callback.

Fails with StatusCode::ARGUMENT_NOT_SUPPORTED for a field out of range, StatusCode::ONBOARDING_HUB_UNREACHABLE, StatusCode::ONBOARDING_HUB_NOT_AUTHENTIC, StatusCode::ONBOARDING_APPROVAL_DENIED (the app is not approved), StatusCode::MEMBER_SPONSOR_NOT_ALLOWED, StatusCode::MEMBER_SPONSOR_QUOTA_EXCEEDED, StatusCode::SESSION_WIDE_ACTION_ON_MEMBER (create it on the primary’s PC) or StatusCode::NOT_IMPLEMENTED (not on Windows).

Source

pub fn join_hub_as_member( &self, invitation: &MemberHubInvitation, config: &JoinHubAsMemberConfig, options: &BlockingOptions<'_>, ) -> Result<()>

Joins the QAROS hub on this PC to the invitation’s primary hub as a member (qar_runtime_join_hub_as_member). This joins the PC’s hub, not the calling application: it does not onboard. Once it returns, onboard as a local app, which then succeeds without a prompt for the application that created the invitation.

Starts the installed hub when none runs for this user; checks the invitation’s signature, expiry and whether this PC trusts its primary; joins, rejoins or readmits the hub and blocks through the hub’s restart into the primary’s session. Called again with an invitation of the primary the hub is already a member of, it succeeds at once. The invitation is borrowed for the call.

Fails with StatusCode::MEMBER_INVITATION_INVALID, StatusCode::MEMBER_INVITATION_EXPIRED, StatusCode::MEMBER_INVITATION_USED_UP, StatusCode::MEMBER_INVITATION_REVOKED (ask for a new invitation), StatusCode::MEMBER_INVITATION_PRIMARY_NOT_ALLOWED, StatusCode::MEMBER_INVITATION_POLICY_NOT_PROTECTED, StatusCode::MEMBER_JOIN_REFUSED, StatusCode::MEMBER_REMOVED, StatusCode::PRIMARY_UNREACHABLE, StatusCode::HUB_LIFECYCLE_OPERATION_RUNNING (retry), StatusCode::ONBOARDING_HUB_UNREACHABLE, StatusCode::ONBOARDING_HUB_NOT_AUTHENTIC, StatusCode::TIMEOUT (the join is committed: calling again succeeds once the hub is back) or StatusCode::NOT_IMPLEMENTED (not on Windows).

Source§

impl Runtime

Source

pub fn as_raw(&self) -> *mut QarRuntime

The QarRuntime handle, for the functions only the raw table of crate::Library::raw_api reaches.

Taking the pointer is safe; using it is unsafe, under the rules of crate::Session::as_raw for a runtime: valid while this Runtime lives, never destroyed by the caller (the last of the Runtime and its sessions releases it), used on the thread that uses this Runtime. A session a raw onboard or rejoin hands out is not a crate::Session: the caller destroys it with qar_session_handle_destroy before this Runtime drops.

Source

pub fn rejoin( &self, onboarding_id: OnboardingId, presentation: &PeerPresentation, options: &BlockingOptions<'_>, ) -> Result<Session>

👎Deprecated:

rejoining a persisted slot is no longer a supported way to join: onboard on every start, as a local app (OnboardMethod::LocalApp), a companion (OnboardMethod::Invite) or through a member hub (OnboardExtensions::remote_app_grant)

Restores the persisted session for onboarding_id without UI (qar_runtime_rejoin). crate::StatusCode::ONBOARDING_SESSION_NOT_FOUND means: onboard instead. The zero id (a local app’s) is refused with Error::InvalidArgument. The peer id is the one persisted by the onboard.

Source

pub fn rejoin_on_adapter( &self, onboarding_id: OnboardingId, presentation: &PeerPresentation, adapter: Option<GraphicsAdapter>, options: &BlockingOptions<'_>, ) -> Result<Session>

👎Deprecated:

rejoining a persisted slot is no longer a supported way to join: onboard on every start with Runtime::onboard_on_adapter, as a local app (OnboardMethod::LocalApp), a companion (OnboardMethod::Invite) or through a member hub (OnboardExtensions::remote_app_grant)

Runtime::rejoin that creates the session’s GPU devices, and with them every render sender’s frame images, on adapter (QarGraphicsDeviceId chained into QarRejoinInit). None lets the library pick.

Source

pub fn onboard( &self, method: &OnboardMethod<'_>, presentation: &PeerPresentation, options: &BlockingOptions<'_>, ) -> Result<Onboarded>

Full onboarding (qar_runtime_onboard), chaining the mode extension of method. The progress callback of options reports the steps (for a local app, “Waiting for approval in QAROS hub” while the prompt is open) and ends before the call returns.

Source

pub fn onboard_on_adapter( &self, method: &OnboardMethod<'_>, presentation: &PeerPresentation, adapter: Option<GraphicsAdapter>, options: &BlockingOptions<'_>, ) -> Result<Onboarded>

Runtime::onboard that creates the session’s GPU devices, and with them every render sender’s frame images, on adapter (QarGraphicsDeviceId, chained after the mode extension as in the Developer Guide’s “Choosing the GPU”). None lets the library pick.

Source

pub fn onboard_with( &self, method: &OnboardMethod<'_>, presentation: &PeerPresentation, extensions: &OnboardExtensions<'_>, options: &BlockingOptions<'_>, ) -> Result<Onboarded>

Runtime::onboard with the optional extensions of extensions.

Source

pub fn start_onboard( &self, method: &OnboardMethod<'_>, presentation: &PeerPresentation, extensions: &OnboardExtensions<'_>, progress: Option<Sender<Progress>>, timeout: Option<Duration>, wake: impl Fn() + Send + Sync + 'static, ) -> Result<PendingOnboard>

Starts Runtime::onboard_with without blocking (qar_runtime_onboard_async) and returns at once; PendingOnboard::poll or PendingOnboard::wait picks up the Onboarded. progress receives the progress reports, sent from a library thread until the result arrives. timeout cancels the call through its cancel token, after which the library calls back with crate::StatusCode::TIMEOUT. wake runs on a library thread right after the result arrived, for example to request a repaint that then polls. See PendingOnboard for dropping it before the result.

Source

pub fn start_rejoin( &self, onboarding_id: OnboardingId, presentation: &PeerPresentation, adapter: Option<GraphicsAdapter>, progress: Option<Sender<Progress>>, timeout: Option<Duration>, wake: impl Fn() + Send + Sync + 'static, ) -> Result<PendingOnboard>

👎Deprecated:

rejoining a persisted slot is no longer a supported way to join: onboard on every start with Runtime::start_onboard, as a local app (OnboardMethod::LocalApp), a companion (OnboardMethod::Invite) or through a member hub (OnboardExtensions::remote_app_grant)

Starts Runtime::rejoin_on_adapter without blocking (qar_runtime_rejoin_async), as Runtime::start_onboard does; the Onboarded it delivers echoes onboarding_id. The zero id is refused with Error::InvalidArgument before the call.

Source

pub fn forget(&self, onboarding_id: OnboardingId) -> Result<()>

👎Deprecated:

persisted slots are no longer a supported way to join, so there is nothing to forget: a local app, a companion and a member hub’s app store nothing; dropping the Session ends it, and revoking the app’s approval in QAROS removes it

Erases a persisted identity slot (qar_runtime_forget): its certificate, persisted instance id and session state. Works with no active session. Fails with crate::StatusCode::ONBOARDING_SESSION_STILL_ACTIVE while a session of that slot is alive, and crate::StatusCode::ONBOARDING_SESSION_NOT_FOUND without a slot.

Trait Implementations§

Source§

impl Debug for Runtime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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