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

Crate qaros

Crate qaros 

Source
Expand description

Safe Rust API over the QAROS streaming C API.

Covers what a streaming application needs: loading and initializing the library, the loaded runtime’s version, runtimes, onboarding and rejoin, blocking or async (pairing code, remote hub, co-process invites, local app approved in the hub, app tags, remote-app grants, a declared device, adapter choice, planned peer id, re-enrollment), member hubs, peers, the CPU render sender, the Vulkan render sender (feature vulkan, module vulkan), the D3D11 render sender (feature d3d11, module d3d11: Windows; on macOS only for the tests against qaros-stub), app volumes and GUI panels. Hands, gestures and world anchors stay in qaros_sys; reach them, and every other raw call, through Library::raw_api.

§Design

  • Every fallible call returns Result; C errors carry the StatusCode and the message from qar_result_message.
  • Init structures are built from the ported qar_*_default() initializers, so every QarStructureHeader is stamped.
  • Handles release themselves on drop, and each keeps its parent alive, so the C teardown order is always render sender, session, runtime, library, whatever order Rust drops them in.
  • None of the handle types is Send: the SDK is designed for single-threaded use per runtime, and callbacks are its only cross-thread surface.
  • Subscription callbacks run on library threads. They receive owned snapshots read from the borrowed C handle during the callback; use channel to forward them into a std::sync::mpsc receiver. Their state lives until the session is destroyed; a Subscription guard only cancels.
use qaros::{BlockingOptions, Library, LibraryConfig, OnboardMethod, PeerPresentation, RuntimeConfig};

// SAFETY: the runtime found (the installed QAROS, or that of the instance QAR_INSTANCE
// names) matches these bindings.
let library = unsafe { Library::load_default(&LibraryConfig::default())? };
let runtime = library.create_runtime(&RuntimeConfig::default())?;
// An app on the hub's PC joins as a local app: the first start waits for Allow in QAROS.
let onboarded = runtime.onboard(
    &OnboardMethod::LocalApp { approval_timeout: None, app_tag: None },
    &PeerPresentation::default(),
    &BlockingOptions::default(),
)?;
let peers = onboarded.session.peers()?;

Re-exports§

pub use qaros_sys;

Modules§

d3d11
The D3D11 render sender path (feature d3d11).
vulkan
The Vulkan render sender path (feature vulkan).

Structs§

AppVolumeConfig
Options for qar_app_volumes_get_or_create.
AppVolumeId
Formats as colon-separated hex bytes, like the C examples’ print_hex_id. Persist onboarding ids with crate::Library::uuid_to_string instead, which uses the library’s own UUID text form.
AppVolumeInfo
Snapshot of a QarAppVolume.
AppVolumeSize
Box extents in meters.
AppVolumes
App volume operations of a session (session.app_volumes()).
BlockingOptions
Optional progress channel and cancellation for the blocking calls.
CancelHandle
Cancels a CancelToken from any thread (qar_cancel_token_cancel). It does not keep the token alive: once the token’s last owner is gone, CancelHandle::cancel does nothing and returns Ok(false).
CancelToken
A QarCancelToken.
CpuFrame
The frame’s CPU textures and the views mapping eyes and color/depth onto them (qar_render_sender_frame_cpu).
CpuTexture
A CPU texture of the current frame, writable until the frame is shown.
DeviceIdentity
The device an application describes itself as (QarPeerDeviceIdentity). Without one it joins as a desktop PC with the fixed id of the host OS (DesktopWindows / DesktopLinux).
Fov
Field of view as four angles in radians, OpenXR style: left and down are normally negative.
Frame
A frame between begin_frame and show_frame, borrowing its sender. Dropping it without Frame::show releases the frame info without presenting.
FrameViewSpec
One view inside the video frame, as declared at sender creation.
GuiPanelConfig
Options for qar_gui_panels_get_or_create.
GuiPanelId
Formats as colon-separated hex bytes, like the C examples’ print_hex_id. Persist onboarding ids with crate::Library::uuid_to_string instead, which uses the library’s own UUID text form.
GuiPanelInfo
Snapshot of a QarGuiPanel.
GuiPanelServedContent
What a served GUI panel shows: one entry page of a content bundle.
GuiPanelSize
Physical size in meters and the scale mapping web content onto it.
GuiPanels
GUI panel operations of a session (session.gui_panels()).
HubAddressDeprecated
Where the hub runs, for onboarding with a code against a remote hub (QarOnboardHostExt).
JoinHubAsMemberConfig
Options for Runtime::join_hub_as_member (QarJoinHubAsMemberInit). None selects the C API’s default; under 1 ms, or over u32::MAX milliseconds, is crate::Error::InvalidArgument before the call, since the C API reads zero as the default.
Library
The loaded and initialized C API library.
LibraryConfig
Options for qar_library_init; the default matches qar_library_init_default().
MemberHubInvitation
A member-hub invitation (QarMemberHubInvitation), destroyed on drop (qar_member_hub_invitation_handle_destroy). A secret bearer credential: send its bytes only over a trusted channel and never log them. The primary hub’s operator sees it in the visualizer and can revoke it.
MemberHubInvitationConfig
Options for Runtime::create_member_hub_invitation (QarMemberHubInvitationInit). None selects the C API’s default.
MemberHubPermissions
The permissions a member-hub invitation grants at the primary hub (QarMemberHubInvitationPermissionFlagBits). Combine them with |.
OnboardExtensions
The optional extensions of Runtime::onboard_with and Runtime::start_onboard, chained after the mode extension in this order: the remote-app grant, the adapter or no graphics device, the planned peer id (deprecated). The re-enrolled onboarding id (deprecated) goes into the init itself.
Onboarded
The result of a successful onboarding or rejoin.
OnboardingId
Key of a persisted identity slot, the ticket for the deprecated crate::Runtime::rejoin and crate::Runtime::forget. Local apps, companions and member hubs’ apps have none to persist.
OnboardingInvite
A QarOnboardingInvite: a full invite blob, onboarded with crate::OnboardMethod::Invite. A co-process invite (crate::Session::request_onboarding_invite) or the launch invite QAROS hands an app it starts. A secret: hand it over a private channel (stdin, a pipe), never on a command line. A co-process invite names the requesting app on this PC and works for every start of the co-process while the app’s session lives; onboarding with it fetches a fresh hub invite from the app on each attempt and retries until it joins.
OwnedFrame
A frame between begin_frame and show_frame that owns a reference to its sender, from RenderSender::begin_owned_frame. Dropping it without OwnedFrame::show releases the frame info without presenting.
PanelContent
Panel content operations of a session (session.panel_content()).
PanelContentBundleId
Names one content bundle (QarPanelContentBundleId): the session that published it and serves its files, and its name, unique per publisher.
PanelContentFile
One file of PanelContent::publish_files (QarPanelContentFile).
PanelContentMessage
A message a served panel sent to its content owner, stamped by the mixer showing it (QarPanelContentMessage).
PeerId
A participant in the session: a device or an application.
PeerIdentity
A peer’s presence, role and device identity (qar_peer_spec_get_presence, _get_role, _get_category, _get_device_id, _get_device_family, _get_device_name), read with the rest of crate::PeerInfo. The device id and name can change while the peer runs (a serving app refines them once the device reports its model): re-read them in a peer update.
PeerInfo
Snapshot of a QarPeerSpec.
PeerPresentation
How this peer presents itself to others (QarPeerPresentation). None keeps the persisted value (or a generated default on first onboard).
PendingCall
An async call in flight: a render sender creation (crate::Session::start_render_sender), an onboard or rejoin (crate::Runtime::start_onboard, crate::Runtime::start_rejoin), a co-process invite (crate::Session::start_onboarding_invite), a target-app invite or kill (crate::Session::start_invite_target_app, crate::Session::start_kill_target_app), or a begin-frame (crate::RenderSender::start_owned_frame). It keeps its owner alive.
Pose
Orientation and position; the default is the identity pose, as qar_pose_default().
Progress
A progress report from a blocking onboarding call.
Quat
Rotation quaternion, scalar last.
RenderRequest
A render stream request from a peer that wants this application’s frames, read inside the callback.
RenderSender
A CPU render stream sender. Keeps its session alive; destroyed with qar_render_stream_handle_destroy after the last open frame.
RenderSenderConfig
Options for qar_render_sender_create on the CPU path.
Runtime
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.
RuntimeConfig
Options for qar_runtime_create; None keeps the library default.
RuntimeInfo
What the loaded qar-streaming-c reports about itself (qar_runtime_info).
Session
A QarSession, obtained by crate::Runtime::rejoin or crate::Runtime::onboard.
SessionId
Formats as colon-separated hex bytes, like the C examples’ print_hex_id. Persist onboarding ids with crate::Library::uuid_to_string instead, which uses the library’s own UUID text form.
SessionLifecycle
One state of a session’s lifecycle (QarSessionLifecycleInfo), copied out of the library.
ShowParams
What show_frame reports about the frame just rendered. The default is qar_render_frame_show_default(): near 0.1, far 100, depth scale 1.
StatusCode
A QarStatusCode as returned by the C API.
StreamId
Correlates render stream requests.
Subscription
Guard for one subscription. Dropping it cancels delivery (through the subscription’s cancel token); the callback itself stays allocated until the session is destroyed. A receiver from crate::channel therefore does not disconnect when the guard drops, only when the session does.
TextureSize
Format and size of one texture of the frame layout (QarTextureSize).
Vec3
Position in meters. Room space is right-handed, Y up, minus Z forward (OpenXR conventions).
VideoFrameLayout
The negotiated layout (qar_render_sender_layout).
VideoFrameView
A view rectangle inside one of the frame’s textures. End coordinates are exclusive and may be smaller than the start (flips).
ViewPose
Per-view pose and field of view to render with, from begin_frame.

Enums§

ActionSeverity
Severity of a progress callback message (QarActionSeverity).
AppState
Lifecycle state of a peer’s application (QarAppState), deprecated in the public header for the peer presence and computed from it there; see crate::PeerInfo::app_state.
AppVolumeLifetime
Whether an app volume is active or closed (QarAppVolumeLifetimeStatus).
ColorAlphaMode
What a render sender’s colour alpha means (QarColorAlphaMode), declared through QarRenderSenderAlphaModeExt. The stream publishes it and a receiver composites by it.
ColorEncoding
What the numbers in a render sender’s colour texture mean (QarColorEncoding), declared through QarRenderSenderColorEncodingExt. Whatever is declared, the stream carries sRGB-encoded colour.
DeviceCategory
What kind of device a peer is (QarDeviceCategory): the fallback when a viewer does not know the peer’s device id or family. A value the header does not name reads as DeviceCategory::Unknown, as the header says to treat it.
Error
Every failure the safe API reports.
Eye
The eye a frame view is for (QarVideoFrameViewEye).
FrameLayout
How views pack into the frame’s textures.
GraphicsAdapter
A graphics adapter, by the id bytes Vulkan and DXGI report for it.
GuiPanelContentType
What a GUI panel shows (QarGuiPanelContentType), fixed at creation.
GuiPanelState
Visibility of a GUI panel (QarGuiPanelState).
LogSeverity
Severity of a library log message (QarLogSeverity).
OnboardMethod
The onboarding path, chained as exactly one mode extension. An app joins in one of three ways: as a local app (OnboardMethod::LocalApp), as a companion of a local app (OnboardMethod::Invite with the app’s crate::Session::request_onboarding_invite), or through a member hub (OnboardMethod::LocalApp with OnboardExtensions::remote_app_grant).
PeerPresence
Where a peer is (QarPeerPresence). Render for PeerPresence::Online peers and PeerPresence::Unknown ones; stop at the others. A value the header does not name reads as PeerPresence::Unknown, as the header says to treat it.
PeerRole
What a peer is in the streaming graph (QarPeerRole). A source renders for the PeerRole::Target peers. A value the header does not name is PeerRole::Other.
PixelFormat
Pixel format of a frame texture (QarPixelFormat).
QarosDeviceKind
The device type whose setup a QarosView::DeviceSetup view shows (QarQarosDeviceKind).
QarosView
A predefined view of the QAROS Visualizer (QarQarosView), opened with crate::Session::open_qaros_view: each is the dialog the qaros://visualizer link of the same name opens. The device kind sits in the setup variant, so no other view can carry one.
RenderLoop
When a render sender’s application renders its frames (QarRenderLoop), declared through QarRenderSenderRenderLoopExt.
SessionChangeCause
Why the session moved into another session id (QarSessionChangeCause). Informational only; treat Self::Other as Self::Rotated.
SessionLifecycleState
Where a session stands in its hub’s session lifecycle (QarSessionLifecycleState). Treat Self::Other as Self::HubUnreachable: the session keeps trying.
SourceDeviceCategory
The device categories an application may declare (QarDeviceCategory). An application always joins as a source; the C API refuses every other category with QAR_STATUS_PEER_DEVICE_CATEGORY_NOT_ALLOWED, so this enum has none of them.
TargetDevice
The device kind a target-app connection string names (Library::target_app_connection_string).
ViewKind
What a frame view holds: color, grayscale or depth (QarVideoFrameViewType).

Constants§

PANEL_CONTENT_BUNDLE_NAME_MAX
Longest bundle name, in bytes (QAR_PANEL_CONTENT_BUNDLE_NAME_MAX).

Functions§

channel
A callback that forwards events into a channel, and the receiving end.
installed_bin_folder
<InstallFolder>\bin of the QAROS installed on this PC, read from HKLM\SOFTWARE\Quaternar\QAROS. None when QAROS is not installed, and always outside Windows.
instance_runtime_folder
The folder holding the runtime of QAROS instance instance, as step 2 of the default lookup picks it: for default the installed QAROS’s <InstallFolder>\bin (installed_bin_folder); for any other name the fully qualified value RuntimeFolder of HKCU\SOFTWARE\Quaternar\QAROS\Instances\<name>, which a QAROS development hub writes for the apps it starts, else that record’s fully qualified <InstallFolder>\bin. None when the name is not valid (crate::is_valid_instance_name), no folder is recorded, or outside Windows, which has no instance records.
requested_instance
The value of QAR_INSTANCE, exactly as set, when it is set and not empty (read lossily when it is not Unicode, which no instance name is). The default lookup reads it on Windows only.

Type Aliases§

PendingFrame
A begin-frame in flight from RenderSender::start_owned_frame, delivering an OwnedFrame.
PendingOnboard
An async onboard or rejoin, delivering an Onboarded.
PendingRenderSender
A render sender being created by crate::Session::start_render_sender, Session::start_vulkan_render_sender (feature vulkan) or Session::start_d3d11_render_sender (feature d3d11). Keeps its session alive, as a sender does, so dropping the crate::Session meanwhile is safe. A D3D11 creation also keeps the device references of its parameters.
Result
The result type of every fallible call in this crate.