Struct webxr_api::SessionBuilder

source ·
pub struct SessionBuilder<'a, GL> {
    sessions: &'a mut Vec<Box<dyn MainThreadSession>>,
    frame_sender: Sender<Frame>,
    layer_grand_manager: LayerGrandManager<GL>,
    id: SessionId,
}
Expand description

A type for building XR sessions

Fields§

§sessions: &'a mut Vec<Box<dyn MainThreadSession>>§frame_sender: Sender<Frame>§layer_grand_manager: LayerGrandManager<GL>§id: SessionId

Implementations§

source§

impl<'a, GL: 'static> SessionBuilder<'a, GL>

source

pub fn id(&self) -> SessionId

source

pub(crate) fn new( sessions: &'a mut Vec<Box<dyn MainThreadSession>>, frame_sender: Sender<Frame>, layer_grand_manager: LayerGrandManager<GL>, id: SessionId, ) -> Self

source

pub fn spawn<Device, Factory>(self, factory: Factory) -> Result<Session, Error>
where Factory: 'static + FnOnce(LayerGrandManager<GL>) -> Result<Device, Error> + Send, Device: DeviceAPI,

For devices which are happy to hand over thread management to webxr.

source

pub fn run_on_main_thread<Device, Factory>( self, factory: Factory, ) -> Result<Session, Error>
where Factory: 'static + FnOnce(LayerGrandManager<GL>) -> Result<Device, Error>, Device: DeviceAPI,

For devices that need to run on the main thread.

Auto Trait Implementations§

§

impl<'a, GL> Freeze for SessionBuilder<'a, GL>

§

impl<'a, GL> !RefUnwindSafe for SessionBuilder<'a, GL>

§

impl<'a, GL> !Send for SessionBuilder<'a, GL>

§

impl<'a, GL> !Sync for SessionBuilder<'a, GL>

§

impl<'a, GL> Unpin for SessionBuilder<'a, GL>

§

impl<'a, GL> !UnwindSafe for SessionBuilder<'a, GL>

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

§

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

§

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.