fmstl
This commit is contained in:
@@ -4,7 +4,31 @@ use toml::Table;
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct BarbarConfig {
|
||||
pub monitor: Option<String>,
|
||||
pub ups: Option<i32>, // Updates per second
|
||||
pub ups: Option<i32>, // Updates per second
|
||||
pub order: ModuleOrder,
|
||||
pub modules: Option<Table>, // 'clock': [clock settings]
|
||||
pub services: Option<Table>, // 'clockticker': [clockticker settings]
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize, Serialize, Clone, Copy, Debug)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum Modules {
|
||||
Clock,
|
||||
Weather,
|
||||
}
|
||||
|
||||
impl Modules {
|
||||
pub fn to_string(&self) -> &str {
|
||||
match self {
|
||||
Modules::Clock => "clock",
|
||||
Modules::Weather => "weather",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone)]
|
||||
pub struct ModuleOrder {
|
||||
pub left: Vec<Modules>,
|
||||
pub middle: Vec<Modules>,
|
||||
pub right: Vec<Modules>,
|
||||
}
|
||||
|
||||
@@ -11,11 +11,9 @@ mod module;
|
||||
mod service;
|
||||
mod wire;
|
||||
|
||||
pub use config::BarbarConfig;
|
||||
pub use config::{BarbarConfig, Modules};
|
||||
pub use effect::ModuleEffect;
|
||||
pub use messages::{ClockKind, ClockMsg, ClockPayload};
|
||||
pub use messages::modules::WeatherKind;
|
||||
pub use messages::services::WeatherResponse;
|
||||
pub use messages::*;
|
||||
pub use module::BarModule;
|
||||
pub use service::Service;
|
||||
pub use wire::{Endpoint, Inbox, Namespace, Target, Wire};
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
mod clock;
|
||||
mod weather;
|
||||
|
||||
pub use clock::ClockMsg;
|
||||
pub use weather::WeatherKind;
|
||||
pub use clock::*;
|
||||
pub use weather::*;
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
mod datetime;
|
||||
mod weather;
|
||||
|
||||
pub use datetime::{ClockKind, ClockPayload};
|
||||
pub use weather::{WeatherKind, WeatherPayload, WeatherResponse};
|
||||
pub use datetime::*;
|
||||
pub use weather::*;
|
||||
|
||||
@@ -5,11 +5,11 @@ use serde::Deserialize;
|
||||
use crate::Service;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||
pub enum WeatherKind {
|
||||
pub enum WeatherMsg {
|
||||
State,
|
||||
}
|
||||
|
||||
impl WeatherKind {
|
||||
impl WeatherMsg {
|
||||
pub fn key(self) -> Service {
|
||||
Service(match self {
|
||||
Self::State => "weather.state",
|
||||
@@ -19,7 +19,7 @@ impl WeatherKind {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct WeatherPayload {
|
||||
pub kind: WeatherKind,
|
||||
pub kind: WeatherMsg,
|
||||
pub payload: Arc<dyn Any + Send + Sync>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user