cotis-utils 0.1.0-alpha

Modular Rust UI framework core
Documentation
//! Shared utility types and trait boundaries for the Cotis ecosystem.
//!
//! This crate contains cross-cutting primitives used by layout managers, renderers,
//! and interactivity layers:
//! - math types such as [`math::Vector2`] and [`math::BoundingBox`]
//! - renderer frame/window contracts in [`traits`]
//! - keyboard and mouse provider traits in [`interactivity`]
//! - text measuring hooks in [`text`]
//! - font registry helpers in [`font_manager`]
//! - runtime element inspection traits in [`element_state`]
//!
//! Unlike `cotis`, this crate does not define app orchestration or layout/renderer
//! interfaces. Unlike `cotis-defaults`, it does not define concrete element config
//! or render command structs.
//!
//! # Features
//!
//! - `serialization`: enables `serde` derives for [`math`] structs (`Vector2`,
//!   `Dimensions`, and `BoundingBox`).
//!
//! # Text and fonts (evolving API)
//!
//! The text, font, and text-measuring APIs are functional today but are planned for
//! refactoring. Integrators should treat `font_id` assignment, [`font_manager::FontManager`],
//! [`text::RendererTextMeasuringProvider`], and [`text::LayoutTextMeasuring`] as
//! subject to change across minor versions until that refactor lands.
//!
//! # Quick start
//!
//! ```rust,ignore
//! use cotis_utils::interactivity::mouse::{MouseButton, MouseProvider};
//! use cotis_utils::math::{Dimensions, Vector2};
//! use cotis_utils::traits::{CotisFrameContext, CotisRenderContext, CotisWindowContext};
//!
//! struct MyRenderer;
//!
//! impl CotisWindowContext for MyRenderer {
//!     fn window_dimensions(&self) -> Dimensions {
//!         Dimensions::new(1280.0, 720.0)
//!     }
//! }
//!
//! impl CotisFrameContext for MyRenderer {
//!     fn get_delta_time(&self) -> f32 {
//!         1.0 / 60.0
//!     }
//! }
//!
//! // CotisRenderContext is implemented automatically.
//!
//! impl MouseProvider for MyRenderer {
//!     fn get_mouse_position(&self) -> Vector2 {
//!         Vector2::new(0.0, 0.0)
//!     }
//!
//!     fn mouse_button_down(&self, _button: MouseButton) -> bool {
//!         false
//!     }
//!
//!     fn get_mouse_wheel_move_v(&self) -> Vector2 {
//!         Vector2::new(0.0, 0.0)
//!     }
//! }
//! ```
/// Element-state query traits used by hit-testing and debug tools.
pub mod element_state;
/// Thread-safe font registry and holder abstractions.
pub mod font_manager;
/// Keyboard/mouse input traits and key/button enums.
pub mod interactivity;
/// Math primitives used by layout, rendering and input providers.
pub mod math;
/// Text measurement provider traits shared by layout and renderers.
pub mod text;
/// Renderer context traits for window state and frame timing.
pub mod traits;