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

PanelContent

Struct PanelContent 

Source
pub struct PanelContent<'session> { /* private fields */ }
Expand description

Panel content operations of a session (session.panel_content()).

A served GUI panel shows a page of a content bundle this session publishes. Every user’s mixer loads the page in its own browser and fetches the files over the session; the page sends with qaros.panel.send(msg) and receives with qaros.panel.onMessage(cb). Publishing copies every byte, so an edit needs another publication, which reloads every panel showing the bundle. Only the publisher may put its bundle on a panel, receives the panels’ messages and posts to them. Limits: 16 MiB per file, 64 MiB and 1024 files per bundle, 64 KiB per message.

Implementations§

Source§

impl<'session> PanelContent<'session>

Source

pub fn publish_files( &self, name: &str, files: &[PanelContentFile], ) -> Result<PanelContentBundleId>

Publishes files as bundle name (qar_panel_content_publish_files), replacing an earlier publication of that name. Nothing is published when it fails: PANEL_CONTENT_BUNDLE_REFUSED, PANEL_CONTENT_PATH_REFUSED, PANEL_CONTENT_MIME_REFUSED or PANEL_CONTENT_SIZE_REFUSED.

Source

pub fn publish_directory( &self, name: &str, root: &Path, ) -> Result<PanelContentBundleId>

Publishes every regular file under root as bundle name (qar_panel_content_publish_directory). A link inside the folder is refused, as is every file PanelContent::publish_files refuses; a missing folder is PANEL_CONTENT_NOT_FOUND.

Source

pub fn remove(&self, bundle: &PanelContentBundleId) -> Result<()>

Stops serving a bundle this session published (qar_panel_content_remove). Panels showing it stay and show nothing.

Source

pub fn post_message( &self, bundle: &PanelContentBundleId, json: &str, panel: Option<GuiPanelId>, user: Option<PeerId>, ) -> Result<()>

Posts one JSON value to the panels showing a bundle this session published (qar_panel_content_post_message): to one panel or all (None), for one user or all.

Source

pub fn subscribe_messages( &self, bundle: &PanelContentBundleId, callback: impl Fn(PanelContentMessage) + Send + Sync + 'static, ) -> Result<Subscription>

Calls callback with every message a panel showing the bundle sends (qar_panel_content_subscribe_messages). Runs on library threads; validate each message before acting on it and authorise per PanelContentMessage::user.

Trait Implementations§

Source§

impl<'session> Debug for PanelContent<'session>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'session> !RefUnwindSafe for PanelContent<'session>

§

impl<'session> !Send for PanelContent<'session>

§

impl<'session> !Sync for PanelContent<'session>

§

impl<'session> !UnwindSafe for PanelContent<'session>

§

impl<'session> Freeze for PanelContent<'session>

§

impl<'session> Unpin for PanelContent<'session>

§

impl<'session> UnsafeUnpin for PanelContent<'session>

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.