Byte Engine Docs
View on docs.rs

ui

Generated Rust API reference for byte_engine.

byte_engine / ui


Module ui

Retained UI components, layout evaluation, styling, and rendering.

Implement an async component function to describe a UI tree and evaluate it with layout::engine::Engine. Components create Container, Text, and other Primitive values through the layout context. Send the resulting layout::engine::Render data to render_pass::UiRenderPass when integrating UI into a graphics application.

See the GUI guide for component, layout, event, focus, and rendering guidance.

Contents

Quick Reference

ItemKindDescription
elementmodConcrete UI elements emitted by layout components.
ConcreteElementstruct
UiPointstruct
UiVectorstruct
Elementtrait
ElementHandletrait
Idtype

Modules

  • element — Concrete UI elements emitted by layout components.

Structs

ConcreteElement

struct ConcreteElement {
    // [REDACTED: Private Fields]
}

Defined in crates/byte-engine/src/ui/element.rs:38-40

The ConcreteElement struct stores one built-in primitive produced by a layout component.

Implementations

  • fn container(container: Container) -> Self

    Related: Container

    Creates an element backed by a container primitive.

  • fn shape(shape: Shape) -> Self

    Creates an element backed by a shape primitive.

  • fn curve(curve: Curve) -> Self

    Related: Curve

    Creates an element backed by a curve primitive.

  • fn image(image: Image) -> Self

    Related: Image

    Creates an element backed by an image primitive.

  • fn text(text: Text) -> Self

    Related: Text

    Creates an element backed by a text primitive.

  • fn text_field(text_field: TextField) -> Self

    Related: TextField

    Creates an element backed by a text field primitive.

Trait Implementations

impl ArchivePointee for ConcreteElement
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for ConcreteElement
impl Downcast for ConcreteElement
  • 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 ConcreteElement
impl LayoutRaw for ConcreteElement
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for ConcreteElement
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointable for ConcreteElement
  • const ALIGN: usize
  • type Init = T
  • unsafe fn init(init: <T as Pointable>::Init) -> usize
  • unsafe fn deref<'a>(ptr: usize) -> &'a T
  • unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
  • unsafe fn drop(ptr: usize)
impl Pointee for ConcreteElement
  • type Metadata = ()
impl Read for ConcreteElement
impl WithSubscriber for ConcreteElement

UiPoint

struct UiPoint {
    pub x: f32,
    pub y: f32,
}

Defined in crates/byte-engine/src/ui/point.rs:9-14

The UiPoint struct carries a two-dimensional UI position.

Use UiPoint for normalized pointer positions and layout-local points. It deliberately has no world-space meaning. Next, pass it to crate::ui::Engine::set_cursor_position.

Fields

  • x: f32

    The horizontal UI coordinate.

  • y: f32

    The vertical UI coordinate.

Implementations

  • const fn new(x: f32, y: f32) -> Self

    Creates a UI position from horizontal and vertical coordinates.

  • const fn zero() -> Self

    Returns the UI origin.

Trait Implementations

impl ArchivePointee for UiPoint
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for UiPoint
impl Clone for UiPoint
  • fn clone(&self) -> UiPoint

    Related: UiPoint

impl Copy for UiPoint
impl Debug for UiPoint
  • fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Default for UiPoint
  • fn default() -> UiPoint

    Related: UiPoint

impl Downcast for UiPoint
  • 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 DowncastSend for UiPoint
  • fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for UiPoint
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Instrument for UiPoint
impl LayoutRaw for UiPoint
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for UiPoint
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for UiPoint
  • fn eq(&self, other: &UiPoint) -> bool

    Related: UiPoint

impl Pointable for UiPoint
  • const ALIGN: usize
  • type Init = T
  • unsafe fn init(init: <T as Pointable>::Init) -> usize
  • unsafe fn deref<'a>(ptr: usize) -> &'a T
  • unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
  • unsafe fn drop(ptr: usize)
impl Pointee for UiPoint
  • type Metadata = ()
impl Read for UiPoint
impl<R> ReadPrimitive for UiPoint
impl StructuralPartialEq for UiPoint
impl WithSubscriber for UiPoint

UiVector

struct UiVector {
    pub x: f32,
    pub y: f32,
}

Defined in crates/byte-engine/src/ui/point.rs:35-40

The UiVector struct carries a two-dimensional UI displacement.

Use UiVector for scroll input and spatial-navigation axes. It deliberately has no world-space meaning. Next, pass it to crate::ui::Engine::update_scroll_state or crate::ui::layout::snapshot::Snapshot::move_cursor.

Fields

  • x: f32

    The horizontal UI displacement.

  • y: f32

    The vertical UI displacement.

Implementations

  • const fn new(x: f32, y: f32) -> Self

    Creates a UI displacement from horizontal and vertical components.

  • const fn zero() -> Self

    Returns the neutral UI displacement.

Trait Implementations

impl ArchivePointee for UiVector
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for UiVector
impl Clone for UiVector
  • fn clone(&self) -> UiVector

    Related: UiVector

impl Copy for UiVector
impl Debug for UiVector
  • fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Default for UiVector
  • fn default() -> UiVector

    Related: UiVector

impl Downcast for UiVector
  • 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 DowncastSend for UiVector
  • fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for UiVector
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Instrument for UiVector
impl LayoutRaw for UiVector
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for UiVector
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for UiVector
  • fn eq(&self, other: &UiVector) -> bool

    Related: UiVector

impl Pointable for UiVector
  • const ALIGN: usize
  • type Init = T
  • unsafe fn init(init: <T as Pointable>::Init) -> usize
  • unsafe fn deref<'a>(ptr: usize) -> &'a T
  • unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
  • unsafe fn drop(ptr: usize)
impl Pointee for UiVector
  • type Metadata = ()
impl Read for UiVector
impl<R> ReadPrimitive for UiVector
impl StructuralPartialEq for UiVector
impl WithSubscriber for UiVector

Traits

Element

trait Element { ... }

Defined in crates/byte-engine/src/ui/element.rs:20-23

The Element trait exposes the primitive represented by a UI element.

Required Methods

  • fn primitive(&self) -> BasePrimitive

    Returns the primitive that layout and rendering systems consume.

ElementHandle

trait ElementHandle { ... }

Defined in crates/byte-engine/src/ui/element.rs:31-34

The ElementHandle trait exposes the stable identity assigned during layout.

Required Methods

  • fn id(&self) -> Id

    Returns the layout identity for this element.

Type Aliases

Id

type Id = std::num::NonZeroU32;

Defined in crates/byte-engine/src/ui/element.rs:28

Stable non-zero identifier assigned to UI elements during layout.

On this page

Module uiContentsQuick ReferenceModulesStructsConcreteElementImplementationsTrait Implementationsimpl ArchivePointee for ConcreteElementimpl<ST> CastableFrom for ConcreteElementimpl Downcast for ConcreteElementimpl Instrument for ConcreteElementimpl LayoutRaw for ConcreteElementimpl<T, N1> Niching for ConcreteElementimpl Pointable for ConcreteElementimpl Pointee for ConcreteElementimpl Read for ConcreteElementimpl WithSubscriber for ConcreteElementUiPointFieldsImplementationsTrait Implementationsimpl ArchivePointee for UiPointimpl<ST> CastableFrom for UiPointimpl Clone for UiPointimpl Copy for UiPointimpl Debug for UiPointimpl Default for UiPointimpl Downcast for UiPointimpl DowncastSend for UiPointimpl DowncastSync for UiPointimpl Instrument for UiPointimpl LayoutRaw for UiPointimpl<T, N1> Niching for UiPointimpl PartialEq for UiPointimpl Pointable for UiPointimpl Pointee for UiPointimpl Read for UiPointimpl<R> ReadPrimitive for UiPointimpl StructuralPartialEq for UiPointimpl WithSubscriber for UiPointUiVectorFieldsImplementationsTrait Implementationsimpl ArchivePointee for UiVectorimpl<ST> CastableFrom for UiVectorimpl Clone for UiVectorimpl Copy for UiVectorimpl Debug for UiVectorimpl Default for UiVectorimpl Downcast for UiVectorimpl DowncastSend for UiVectorimpl DowncastSync for UiVectorimpl Instrument for UiVectorimpl LayoutRaw for UiVectorimpl<T, N1> Niching for UiVectorimpl PartialEq for UiVectorimpl Pointable for UiVectorimpl Pointee for UiVectorimpl Read for UiVectorimpl<R> ReadPrimitive for UiVectorimpl StructuralPartialEq for UiVectorimpl WithSubscriber for UiVectorTraitsElementRequired MethodsElementHandleRequired MethodsType AliasesId