Byte Engine Docs
View on docs.rs

byte_engine

Generated Rust API reference for byte_engine.

Crate byte_engine

Byte-Engine is a composable Rust game engine for applications that need graphics, input, audio, physics, and retained UI in one runtime.

Headed applications usually start with GraphicsApplication and default_setup. Lower-level users can compose application::BaseApplication, factories, channels, render passes, and UI layout pieces directly.

use byte_engine::application::Parameter;
use byte_engine::application::graphics::{default_setup, GraphicsApplication};

let mut application = GraphicsApplication::new("example", &[] as &[Parameter]);
default_setup(&mut application);

Start with the getting started guide for installation, project setup, and the first application workflow.

Contents

Quick Reference

ItemKindDescription
utilsmodThe utils module provides engine utility types through the main byte_engine crate API.
animationmodFlipbook playback, skeletal animation sampling, and pose blending.
applicationmodApplication lifecycle and composition.
audiomodAudio playback and procedural synthesis.
configurationmodAsynchronous configuration messages used by debugging adapters and engine systems.
coremodShared ownership, messaging, factories, and lane primitives.
inputmodDevice-independent input actions, collected once and pulled by layered sinks.
uimodRetained UI components, layout evaluation, styling, and rendering.
constantsmodCommon directions in the engine's default coordinate system.
gameplaymodWorld-level gameplay objects and transform coordination.
networkmodBETP client/server integration and replication contracts.
physicsmodPhysics contracts and the built-in Dynabit simulation.
renderingmodRendering orchestration, scene pipelines, and composable post-processing.
spacemodSmall spatial capability traits shared by gameplay, physics, and rendering.
timemodFixed-rate time used by engine simulation and media timelines.
inspectormodRuntime inspection contracts and protocol-facing state access.
metricsmodPer-tick performance samples for tooling that reads them over the inspector.
MediaTimestruct
and!macroAwaits related activities in written order, discarding their results.
perform!macroRepeats async branches, checking their waits in written order.

Modules

  • utils — The utils module provides engine utility types through the main byte_engine crate API.
  • animation — Flipbook playback, skeletal animation sampling, and pose blending.
  • application — Application lifecycle and composition.
  • audio — Audio playback and procedural synthesis.
  • configuration — Asynchronous configuration messages used by debugging adapters and engine systems.
  • core — Shared ownership, messaging, factories, and lane primitives.
  • input — Device-independent input actions, collected once and pulled by layered sinks.
  • ui — Retained UI components, layout evaluation, styling, and rendering.
  • constants — Common directions in the engine's default coordinate system.
  • gameplay — World-level gameplay objects and transform coordination.
  • network — BETP client/server integration and replication contracts.
  • physics — Physics contracts and the built-in Dynabit simulation.
  • rendering — Rendering orchestration, scene pipelines, and composable post-processing.
  • space — Small spatial capability traits shared by gameplay, physics, and rendering.
  • time — Fixed-rate time used by engine simulation and media timelines.
  • inspector — Runtime inspection contracts and protocol-facing state access.
  • metrics — Per-tick performance samples for tooling that reads them over the inspector.

Structs

MediaTime

struct MediaTime();

Defined in crates/byte-engine/src/time.rs:20

The MediaTime struct provides a shared, allocation-free time unit for simulation, animation, and media synchronization.

Implementations

  • const ZERO: Self
  • const MIN: Self
  • const MAX: Self
  • const TICKS_PER_SECOND: i64
  • const fn from_ticks(ticks: i64) -> Self

    Creates a time value from raw engine ticks.

  • const fn as_ticks(self) -> i64

    Returns the raw engine tick count.

  • fn from_seconds(seconds: i64) -> Self

    Creates a time value from a whole number of seconds.

  • fn from_seconds_f64(seconds: f64) -> Self

    Creates a time value from fractional seconds, rounded to the nearest tick.

  • fn from_seconds_f32(seconds: f32) -> Self

    Creates a time value from fractional seconds, rounded to the nearest tick.

  • fn from_millis(milliseconds: i64) -> Self

    Creates a time value from milliseconds.

  • fn from_micros(microseconds: i64) -> Self

    Creates a time value from microseconds, rounded to the nearest tick.

  • fn from_frames(frame_count: i64, frames_per_second: u32) -> Option<Self>

    Creates the duration occupied by an exact number of frames.

    Returns None when the frame rate does not divide the engine timebase or

    when the resulting tick count would overflow.

  • fn from_samples(sample_count: i64, samples_per_second: u32) -> Option<Self>

    Creates the duration occupied by an exact number of audio samples.

    Returns None when the sample rate does not divide the engine timebase or

    when the resulting tick count would overflow.

  • fn from_std(duration: Duration) -> Self

    Converts a standard duration into engine time, rounded to the nearest tick.

  • fn to_std(self) -> Duration

    Converts a non-negative engine time into a standard duration.

  • fn as_seconds_f64(self) -> f64

    Returns this time value as fractional seconds.

  • fn as_seconds_f32(self) -> f32

    Returns this time value as fractional seconds.

  • const fn checked_add(self, rhs: Self) -> Option<Self>

    Returns the sum, or None when it falls outside the timeline range.

  • const fn checked_sub(self, rhs: Self) -> Option<Self>

    Returns the difference, or None when it falls outside the timeline range.

  • const fn saturating_sub(self, rhs: Self) -> Self

    Returns the difference clamped to the timeline range.

Trait Implementations

impl Add for MediaTime
  • type Output = MediaTime
  • fn add(self, rhs: Self) -> <Self as >::Output
impl AddAssign for MediaTime
  • fn add_assign(&mut self, rhs: Self)
impl ArchivePointee for MediaTime
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for MediaTime
impl Clone for MediaTime
  • fn clone(&self) -> MediaTime

    Related: MediaTime

impl<K> Comparable for MediaTime
  • fn compare(&self, key: &K) -> Ordering
impl Copy for MediaTime
impl Debug for MediaTime
  • fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
impl Default for MediaTime
  • fn default() -> MediaTime

    Related: MediaTime

impl Div for MediaTime
  • type Output = MediaTime
  • fn div(self, rhs: i64) -> <Self as >::Output
impl Downcast for MediaTime
  • 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 MediaTime
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Eq for MediaTime
impl<K> Equivalent for MediaTime
  • fn equivalent(&self, key: &K) -> bool
impl Hash for MediaTime
  • fn hash<__H: hash::Hasher>(&self, state: &mut __H)
impl Instrument for MediaTime
impl LayoutRaw for MediaTime
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl Mul for MediaTime
  • type Output = MediaTime
  • fn mul(self, rhs: i64) -> <Self as >::Output
impl Neg for MediaTime
  • type Output = MediaTime
  • fn neg(self) -> <Self as >::Output
impl<T, N1> Niching for MediaTime
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Ord for MediaTime
  • fn cmp(&self, other: &MediaTime) -> cmp::Ordering

    Related: MediaTime

impl PartialEq for MediaTime
  • fn eq(&self, other: &MediaTime) -> bool

    Related: MediaTime

impl PartialOrd for MediaTime
  • fn partial_cmp(&self, other: &MediaTime) -> option::Option<cmp::Ordering>

    Related: MediaTime

impl Pointee for MediaTime
  • type Metadata = ()
impl Read for MediaTime
impl<R> ReadPrimitive for MediaTime
impl StructuralPartialEq for MediaTime
impl Sub for MediaTime
  • type Output = MediaTime
  • fn sub(self, rhs: Self) -> <Self as >::Output
impl SubAssign for MediaTime
  • fn sub_assign(&mut self, rhs: Self)
impl WithSubscriber for MediaTime

Macros

and!

Defined in crates/byte-engine/src/gameplay/tasks.rs:81-102

Awaits related activities in written order, discarding their results.

Use this inside a perform! branch for activities that belong to the same update. Each expression is created only after the previous one finishes, so successive calls can borrow the same mutable state. If an activity suspends, the group suspends there; later activities start when it finishes.

Write when future => { activities } to run activities only if the event is ready at that point. The event is polled once in the current task's context, then dropped. A pending event skips its activities without suspending the group. Event futures must tolerate cancellation; keep their underlying listener or state between updates. The body uses the same awaited activity syntax, and can suspend once selected, just like an ordinary activity.

perform!

Defined in crates/byte-engine/src/gameplay/tasks.rs:119-164

Repeats async branches, checking their waits in written order.

Write when future => { actions } to handle an event, or each value = future => { actions } to handle repeated updates and use their results. Wait expressions are rebuilt for each selection and fused automatically. The first ready wait chooses the branch, whose actions run to completion before another branch is chosen. An await inside those actions can suspend the entire performance. Use break to end it or return to end the enclosing task.

Add always { actions } for a shared step before each selection, including the first. It runs again after a selected branch finishes, and may await while borrowing the same state as the branches. It does not run in parallel with a branch or while a nested performance is active. break and return leave immediately.

Nest a performance inside a branch to replace the outer activities until that inner performance ends. The original select_biased! branch syntax is also accepted; fuse those futures yourself.

On this page