toddy_core/lib.rs
1//! # toddy-core
2//!
3//! The public SDK for toddy. Extension authors depend on this crate to
4//! implement the [`WidgetExtension`](extensions::WidgetExtension) trait
5//! and build custom native widgets. The [`prelude`] module re-exports
6//! everything an extension needs; [`iced`] is re-exported so extensions
7//! don't need a direct iced dependency.
8//!
9//! This crate also provides the rendering engine, wire protocol, and
10//! widget infrastructure used internally by the `toddy` binary.
11//!
12//! ## Module guide
13//!
14//! **Core engine:**
15//! - [`engine`] -- `Core` struct: pure state management decoupled from iced runtime
16//! - [`tree`] -- tree data structure, patch application, window discovery
17//! - [`message`] -- `Message` enum, keyboard/mouse serialization helpers
18//!
19//! **Widgets:**
20//! - [`widgets`] -- tree node to iced widget rendering (all widget types)
21//! - [`widgets::overlay`] -- custom `Widget` + `Overlay` impl for positioned overlays
22//!
23//! **Protocol:**
24//! - [`protocol`] -- wire message parsing and event serialization
25//! - [`codec`] -- wire codec: JSON + MessagePack encode/decode/framing
26//!
27//! **Platform:**
28//! - [`theming`] -- theme resolution, custom palette parsing, hex colors
29//! - [`effects`] -- platform effect handlers (file dialogs, clipboard, notifications)
30//! - [`image_registry`] -- in-memory image handle storage
31//!
32//! **Extension SDK:**
33//! - [`extensions`] -- `WidgetExtension` trait, `ExtensionDispatcher`, `ExtensionCaches`
34//! - [`app`] -- `ToddyAppBuilder` for registering extensions
35//! - [`prelude`] -- common re-exports for extension authors
36//! - [`prop_helpers`] -- public prop extraction helpers for extension authors
37//! - [`testing`] -- test factory helpers for extension authors
38
39#![deny(warnings)]
40
41// Ensure catch_unwind works: extension panic isolation requires unwinding.
42// If this fails, remove `panic = "abort"` from your Cargo profile.
43#[cfg(all(not(test), panic = "abort"))]
44compile_error!(
45 "toddy-core requires panic=\"unwind\" (the default). \
46 Extension panic isolation via catch_unwind is a no-op with panic=\"abort\"."
47);
48
49pub mod app;
50pub mod codec;
51pub mod effects;
52pub mod engine;
53pub mod extensions;
54pub mod image_registry;
55pub mod message;
56pub mod prelude;
57pub mod prop_helpers;
58pub mod protocol;
59pub mod testing;
60pub mod theming;
61pub mod tree;
62pub mod widgets;
63
64// Re-export iced so extension crates can use `toddy_core::iced::*` without
65// adding a direct iced dependency. This avoids version conflicts when
66// toddy-core bumps its iced version -- extensions that use only
67// `toddy_core::prelude::*` and `toddy_core::iced::*` get the upgrade
68// automatically.
69pub use iced;