pub struct SessionBuilder { /* private fields */ }Expand description
Builder for providing the configuration of a new Session.
Implementations§
Source§impl SessionBuilder
impl SessionBuilder
Sourcepub async fn build(self) -> Session
pub async fn build(self) -> Session
Create the Session with configuration from this builder.
This is an async function for the sake of cancellation and optional cooperative multitasking, while constructing the initial state. It may safely be blocked on from a synchronous context.
Sourcepub fn ui(self, viewport: DynSource<Viewport>) -> Self
pub fn ui(self, viewport: DynSource<Viewport>) -> Self
Enable graphical user interface.
Requires knowing the expected viewport so that UI can be laid out to fit the aspect ratio.
If this is not called, then the session will simulate a world but not present any
controls for it other than those provided directly by the InputProcessor.
Sourcepub fn fullscreen(
self,
state: DynSource<Option<bool>>,
setter: Option<Arc<dyn Fn(bool) + Send + Sync>>,
) -> Self
pub fn fullscreen( self, state: DynSource<Option<bool>>, setter: Option<Arc<dyn Fn(bool) + Send + Sync>>, ) -> Self
Enable awareness of whether the session is being displayed full-screen.
stateshould report the current state (true= is full screen). ANonevalue means the state is unknown.setteris a function which attempts to change the fullscreen state.
Sourcepub fn settings_from(self, settings: Settings) -> Self
pub fn settings_from(self, settings: Settings) -> Self
Enable reading and writing user settings.
The session will get a new Settings object which inherits the given settings.
If this is not called, then the session will have all default settings, and they will not be persisted.
Sourcepub fn quit(
self,
quit_fn: Arc<dyn Fn() -> Result<QuitSucceeded, QuitCancelled> + Send + Sync>,
) -> Self
pub fn quit( self, quit_fn: Arc<dyn Fn() -> Result<QuitSucceeded, QuitCancelled> + Send + Sync>, ) -> Self
Enable a “quit”/“exit” command in the session’s user interface.
This does not cause the session to self-destruct; rather, the provided callback function should cause the session’s owner to stop presenting it to the user (and be dropped). It may also report that the quit was cancelled for whatever reason.
Trait Implementations§
Source§impl Clone for SessionBuilder
impl Clone for SessionBuilder
Source§fn clone(&self) -> SessionBuilder
fn clone(&self) -> SessionBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SessionBuilder
impl !RefUnwindSafe for SessionBuilder
impl Send for SessionBuilder
impl Sync for SessionBuilder
impl Unpin for SessionBuilder
impl !UnwindSafe for SessionBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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