application
Generated Rust API reference for byte_engine.
Module application
Application lifecycle and composition.
Use BaseApplication when building a custom runtime that only needs parameter
handling and frame-local storage. Headed applications should start with
GraphicsApplication and choose either default_setup or individual
graphics setup functions.
The triangle example demonstrates the standard setup path, while the
window example demonstrates selecting only one setup component.
Contents
Quick Reference
| Item | Kind | Description |
|---|---|---|
application | mod | The minimal process configuration shared by higher-level runtimes. |
thread | mod | Worker-thread support for application-owned subsystems. |
waker | mod | Wakes the application loop while it waits for window events. |
graphics | mod | Headed application runtime and graphics setup entry points. |
BaseApplication | struct | |
LoopWaker | struct | |
Time | struct | The [Time] struct provides frame timing to application systems without exposing the lifecycle clock owned by the application. |
Parameter | struct | The [Parameter] struct represents one application configuration value from code, the environment, or command-line arguments. |
Events | enum | The [Events] enum defines messages shared with application-owned worker threads. |
Modules
application— The minimal process configuration shared by higher-level runtimes.thread— Worker-thread support for application-owned subsystems.waker— Wakes the application loop while it waits for window events.graphics— Headed application runtime and graphics setup entry points.
Structs
BaseApplication
struct BaseApplication {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/application/application.rs:26-39
The BaseApplication struct provides shared process configuration and
frame-local storage for application implementations.
Embed it in a specialized application rather than using it as a complete game
loop. GraphicsApplication uses the established headed composition pattern.
Implementations
-
fn new(name: &str, parameters: &[Parameter]) -> BaseApplicationRelated:
Parameter,BaseApplicationCreates the process configuration with the specified name and configuration parameters.
Parameters may be overridden by the project's
config.json, then byBE_*environment variables, and then by--name=valuecommand-line arguments. In an environment variable's name,_stands for-and__for.,so
BE_PHYSICS__STEP_LANESsetsphysics.step-lanes. Seeparameters_from_jsonfor the file's format.Applications are
singletons: this also installs the process logger and the
tracingsubscriber that feeds span times intoConfiguration
-
log.level: Sets the most verboseloglevel that is printed:trace,debug,info,warn,error, oroff. -
trace: Prints everytracingspan and event atDEBUGor less verbose levels to standard output.
With the
tracyCargo feature, spans and logs also stream to a connected Tracy profiler. -
-
fn get_name(&self) -> &strReturns the name of the application.
-
fn metrics(&self) -> &Arc<Metrics>Related:
MetricsReturns the per-tick performance samples every
tracingspan of the process reports into.Register GPU or custom metrics on it with
Metrics::register; the runtime that owns the tick calls -
fn messages(&self) -> &MessageScopeRelated:
MessageScopeReturns the application message scope, where application-wide routes such as window events live.
Next, call
MessageScope::channelorMessageScope::factoryto add an application-defined route. -
fn message_bus(&self) -> &MessageBusRelated:
MessageBusReturns the shared fixed-storage message bus for diagnostics and new scopes.
Next, call
MessageBus::new_scopeto isolate routes owned by another subsystem, such as a world. -
fn events(&self) -> &DefaultChannel<Events>Related:
EventsReturns the channel of application lifecycle events. Ctrl-C and tools post
Events::Closehere, andworker threads subscribe to it to learn when to stop.
-
fn next_event(&mut self) -> Option<Events>Related:
EventsReads the next lifecycle event for the runtime that owns the loop, which stops on
Events::Close. -
fn parameters(&self) -> &[Parameter]Related:
ParameterReturns the resolved startup parameters after code, environment, and command-line precedence.
Next, hand a system its subtree with
Parameters::scope.
Trait Implementations
impl ArchivePointee for BaseApplication
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for BaseApplication
impl Downcast for BaseApplication
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl Instrument for BaseApplication
impl LayoutRaw for BaseApplication
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for BaseApplication
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for BaseApplication
-
type Metadata = ()
impl Read for BaseApplication
impl WithSubscriber for BaseApplication
LoopWaker
struct LoopWaker();Defined in crates/byte-engine/src/application/waker.rs:19
The LoopWaker struct makes a waiting application loop run its next tick.
Take one with GraphicsApplication::waker, hand it to whatever changes state the loop cannot observe through
window events, and call Self::wake from any thread afterwards. Wakes are coalesced, and waking a loop that
is not waiting only costs two atomic operations. A LoopWaker also converts into a std::task::Waker for
futures that must run inside the loop's own tick.
Implementations
-
fn wake(&self)Makes the application loop run its next tick without waiting for an event.
Trait Implementations
impl ArchivePointee for LoopWaker
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for LoopWaker
impl Clone for LoopWaker
-
fn clone(&self) -> LoopWakerRelated:
LoopWaker
impl Default for LoopWaker
-
fn default() -> LoopWakerRelated:
LoopWaker
impl Downcast for LoopWaker
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for LoopWaker
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for LoopWaker
impl LayoutRaw for LoopWaker
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for LoopWaker
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for LoopWaker
-
type Metadata = ()
impl Read for LoopWaker
impl<R> ReadPrimitive for LoopWaker
impl WithSubscriber for LoopWaker
Time
struct Time {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/application/mod.rs:29-32
The Time struct provides frame timing to application systems without exposing
the lifecycle clock owned by the application.
Implementations
-
fn new(elapsed: MediaTime, delta: MediaTime) -> SelfRelated:
MediaTimeCreates frame timing data for systems that run inside an application tick.
-
fn elapsed(&self) -> MediaTimeRelated:
MediaTimeReturns the total time since the application started.
-
fn delta(&self) -> MediaTimeRelated:
MediaTimeReturns the time since the previous application tick.
Trait Implementations
impl ArchivePointee for Time
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for Time
impl Clone for Time
-
fn clone(&self) -> TimeRelated:
Time
impl Copy for Time
impl Debug for Time
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for Time
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for Time
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for Time
impl LayoutRaw for Time
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for Time
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for Time
-
type Metadata = ()
impl Read for Time
impl WithSubscriber for Time
Parameter
struct Parameter {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/application/mod.rs:54-57
The Parameter struct represents one application configuration value from
code, the environment, or command-line arguments.
Implementations
-
fn new(name: &str, value: &str) -> SelfCreates a parameter from borrowed name and value strings.
-
fn new_string(name: String, value: String) -> SelfCreates a parameter from owned name and value strings.
-
fn is(&self, name: &str) -> boolReturns whether this parameter has the requested name.
-
fn as_bool(&self) -> Option<bool>Parses the parameter's value as a bool.
Returns
Some(true)fortrue,TRUE, or1. ReturnsSome(false)forfalse,FALSE, or0. ReturnsNonefor all other values. -
fn as_bool_simple(&self) -> boolParses the parameter as a Boolean value and returns
falseif parsing fails.Use
Self::as_boolwhen the caller must distinguishfalsefrom aninvalid value.
-
fn parse<T: std::str::FromStr>(&self) -> Result<T, ParameterError>Related:
ParameterErrorParses the parameter's value for a setting of type
T.Each caller chooses its own policy for an invalid value: ignore it with
.ok(), or stop with.unwrap_or_else(|error| panic!("{error}")).Errors
Returns
ParameterErrornaming the parameter and the rejected value whenTcannot parse it. -
fn name(&self) -> &strReturns the parameter name used by application configuration lookup.
-
fn value(&self) -> &strReturns the raw parameter value before caller-specific parsing.
Trait Implementations
impl ArchivePointee for Parameter
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for Parameter
impl Clone for Parameter
-
fn clone(&self) -> ParameterRelated:
Parameter
impl Debug for Parameter
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for Parameter
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for Parameter
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Eq for Parameter
impl<K> Equivalent for Parameter
-
fn equivalent(&self, key: &K) -> bool
impl Hash for Parameter
-
fn hash<__H: hash::Hasher>(&self, state: &mut __H)
impl Instrument for Parameter
impl LayoutRaw for Parameter
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for Parameter
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for Parameter
-
fn eq(&self, other: &Parameter) -> boolRelated:
Parameter
impl Pointee for Parameter
-
type Metadata = ()
impl Read for Parameter
impl StructuralPartialEq for Parameter
impl WithSubscriber for Parameter
Enums
Events
enum Events {
Close,
}Defined in crates/byte-engine/src/application/mod.rs:130-133
The Events enum defines messages shared with application-owned worker threads.
Variants
-
CloseRequests that the application close.
Trait Implementations
impl ArchivePointee for Events
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for Events
impl Clone for Events
-
fn clone(&self) -> EventsRelated:
Events
impl Copy for Events
impl Debug for Events
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for Events
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for Events
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Eq for Events
impl<K> Equivalent for Events
-
fn equivalent(&self, key: &K) -> bool
impl Instrument for Events
impl LayoutRaw for Events
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for Events
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for Events
-
fn eq(&self, other: &Events) -> boolRelated:
Events
impl Pointee for Events
-
type Metadata = ()