asked the clanker to change the arcidecture a bit
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
//! Barbar's protocol crate: the types that cross crate boundaries.
|
||||
//!
|
||||
//! Nothing here may reference app-level types (`Message`, `Cmd`, `Msg`,
|
||||
//! Nothing here may reference app-level types (`Message`, `Msg`,
|
||||
//! layer-shell effects). `common` is the hub every other crate depends on,
|
||||
//! so it must stay acyclic and pure.
|
||||
|
||||
use std::any::Any;
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
|
||||
use iced::window;
|
||||
use iced::{Element, Task};
|
||||
use iced::{Element, Rectangle, Task};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Service model
|
||||
@@ -95,12 +96,16 @@ impl fmt::Debug for ModuleMsg {
|
||||
}
|
||||
}
|
||||
|
||||
/// What a module asks the app to do. Modules never name app types; the app
|
||||
/// maps these into its own effects (`Cmd`).
|
||||
/// What a module asks the app to do — the single effect vocabulary shared by
|
||||
/// modules and app, so mapping module output into a `Message` is a plain
|
||||
/// `.map(Message::Effect)` with no mirror enum.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ModuleEffect {
|
||||
/// Toggle a popup for the given module id (element id anchors it).
|
||||
RequestPopup(String, String),
|
||||
/// A widget-tree pass reported a module's laid-out bounds; anchor the
|
||||
/// popup there. App-internal, but one effect type keeps routing trivial.
|
||||
BoundsFound(String, Rectangle),
|
||||
/// Request removal of the popup surface.
|
||||
ClosePopup(window::Id),
|
||||
}
|
||||
@@ -124,4 +129,11 @@ pub trait BarModule: Send {
|
||||
fn popup_size(&self) -> Option<(u32, u32)> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Digest config from `module.{module-id}`. Error is boxed because this
|
||||
/// runs through `dyn BarModule`; each impl keeps its own concrete error
|
||||
/// internally and may surface it pre-box via its constructor instead.
|
||||
fn config(&mut self, _config: toml::Table) -> Result<(), Box<dyn Error>> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user