pub struct App { /* private fields */ }Expand description
The application: a world plus the loop state that drives it.
Implementations§
Source§impl App
impl App
Sourcepub fn in_tree(self, tree: StateTree) -> Self
pub fn in_tree(self, tree: StateTree) -> Self
An app that reads and writes under tree: its blobs, its settings, its
saves, and the caches it warms. Without one the app runs a world and
touches no disk.
Sourcepub fn state_tree(&self) -> Option<&StateTree>
pub fn state_tree(&self) -> Option<&StateTree>
The state tree this app runs against, if it has one.
Sourcepub fn from_world(world: World) -> Self
pub fn from_world(world: World) -> Self
An app holding an already-built world, ready to start or run.
Sourcepub fn from_blob(path: &Path) -> Result<Self, StartupError>
pub fn from_blob(path: &Path) -> Result<Self, StartupError>
An app holding the world compiled into the blob file at path.
Overflow payload blobs are its siblings named by index, so a world
written to data/0 reads data/1, data/2, … beside it.
Derives the state tree from the blob’s own directory, so the settings
and saves the app writes land with the world it read rather than under
the directory it was launched from. A caller with a tree of its own
builds the app with in_tree instead. The world’s own
AppConfig.home overrides either at start.
Sourcepub fn load_blob(&mut self) -> Result<(), CnResult>
pub fn load_blob(&mut self) -> Result<(), CnResult>
Load assets and blob payload data from the primary blob under this app’s
state tree, and populate the world. Replaces any previously loaded
world. NoStateRoot when the app has no tree to read from.
Sourcepub fn primary_blob(&self) -> Option<PathBuf>
pub fn primary_blob(&self) -> Option<PathBuf>
The primary blob this app reads: blob 0 under its tree’s data/.
None for an app with no tree.
Sourcepub fn shutdown_token(&self) -> ShutdownToken
pub fn shutdown_token(&self) -> ShutdownToken
clone of the root cancellation token. Pass this to systems or the ctrl+c handler so they all share a single cancellation source
Sourcepub fn start(&mut self) -> Result<(), CnResult>
pub fn start(&mut self) -> Result<(), CnResult>
Build the world’s systems and run their init. Must run once, before
the first step.
Sourcepub fn into_world(self) -> World
pub fn into_world(self) -> World
Take the app’s world back, so a caller can put it on a different loop.
Sourcepub fn load_world(&mut self, world: World)
pub fn load_world(&mut self, world: World)
Replace the current world and reset to Created so start() can be called again. Used to load a new scene at runtime.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Sync for App
impl !UnwindSafe for App
impl Send for App
impl Unpin for App
impl UnsafeUnpin for App
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().