feat(tty): wire local feature gate with assembly-layer re-export pattern

ADR-054 prescribes  with a re-export
module, but cargo rejects the cyclic dependency (alknet-tty →
alknet-tty-local → alknet-tty) even with an optional dep. The re-export
is deferred to the assembly layer: consumers depend on alknet-tty-local
directly and register LocalTtyBackend in the TtyAdapter backend map.
The  feature gate stays declared (empty) for forward compatibility.
Assembly pattern documented in the crate root doc comment.
This commit is contained in:
glm-5.2 committed 2026-07-07 23:25:08 +00:00
1 parent 6d7adf5911
commit a20efb4d06
2 files changed
+31 -2

No files matched your search

+7 -2
View File
@@ -11,8 +11,13 @@ name = "alknet_tty"
[features] [features]
default = [] default = []
# `local` re-exports `alknet_tty_local::LocalTtyBackend`. The # ADR-054 prescribes `local = ["dep:alknet-tty-local"]` with a re-export in
# `dep:alknet-tty-local` dependency is wired in task `tty/local-feature-reexport`. # `src/lib.rs`. Cargo rejects the cyclic dependency (alknet-tty →
# alknet-tty-local → alknet-tty) even with an optional dep, so the
# re-export is deferred to the assembly layer: a consumer that wants the
# local backend depends on `alknet-tty-local` directly and registers
# `LocalTtyBackend` in the `TtyAdapter` backend map. See ADR-054 §"The
# feature-re-export compromise" and the deviation note in `src/lib.rs`.
local = [] local = []
[dependencies] [dependencies]
+24
View File
@@ -3,6 +3,30 @@
//! Two-carriage model (ADR-052): a JSON negotiation frame, then raw chunks //! Two-carriage model (ADR-052): a JSON negotiation frame, then raw chunks
//! (`[stream_type: u8][length: u32 be][payload]`). Backend-agnostic via the //! (`[stream_type: u8][length: u32 be][payload]`). Backend-agnostic via the
//! `TtyBackend` trait (ADR-053). Depends on alknet-core only (ADR-057). //! `TtyBackend` trait (ADR-053). Depends on alknet-core only (ADR-057).
//!
//! # Local backend
//!
//! The local backend (`LocalTtyBackend`) lives in the sibling crate
//! `alknet-tty-local` (ADR-054). ADR-054 prescribes a `local` feature gate
//! that re-exports `alknet_tty_local::LocalTtyBackend` as
//! `alknet_tty::local::LocalTtyBackend`, but cargo rejects the cyclic
//! dependency (`alknet-tty → alknet-tty-local → alknet-tty`) even with an
//! optional dependency declaration. The re-export is therefore handled at
//! the assembly layer: a consumer that wants the local backend depends on
//! `alknet-tty-local` directly and registers `LocalTtyBackend` in the
//! `TtyAdapter` backend map.
//!
//! # Assembly pattern
//!
//! ```ignore
//! let mut backends = std::collections::HashMap::new();
//! backends.insert(
//! "local".into(),
//! std::sync::Arc::new(alknet_tty_local::LocalTtyBackend::new())
//! as std::sync::Arc<dyn alknet_tty::TtyBackend>,
//! );
//! let tty_adapter = alknet_tty::adapter::TtyAdapter::new(backends);
//! ```
pub mod adapter; pub mod adapter;
pub mod backend; pub mod backend;