From 0672b217583da4d7c5374bf615e3d0bdb9340443 Mon Sep 17 00:00:00 2001 From: faumaray Date: Wed, 21 Oct 2026 05:55:24 +0300 Subject: [PATCH] Warn about undocumented public items of voelin-ui-vm #![warn(missing_docs)] on the crate, with the fields and variants that had no docs documented (BBCode styles and spans, settings, the tree's input) and a targeted allow on the two mirror modules, bridge and studio_bridge, whose fields are those of the Slint structs and are explained by the comments in bridge.slint and studio-bridge.slint. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-ui-vm/src/bbcode.rs | 16 +++++++++++++++- crates/voelin-ui-vm/src/bridge.rs | 5 +++++ crates/voelin-ui-vm/src/chat.rs | 2 ++ crates/voelin-ui-vm/src/emoji.rs | 2 ++ crates/voelin-ui-vm/src/home.rs | 2 ++ crates/voelin-ui-vm/src/lib.rs | 7 +++++++ crates/voelin-ui-vm/src/servers.rs | 1 + crates/voelin-ui-vm/src/settings.rs | 15 +++++++++++++++ crates/voelin-ui-vm/src/studio/mod.rs | 3 +++ crates/voelin-ui-vm/src/studio_bridge.rs | 4 +++- crates/voelin-ui-vm/src/tree.rs | 6 ++++++ 11 files changed, 61 insertions(+), 2 deletions(-) diff --git a/crates/voelin-ui-vm/src/bbcode.rs b/crates/voelin-ui-vm/src/bbcode.rs index 1b8f238..24a67d3 100644 --- a/crates/voelin-ui-vm/src/bbcode.rs +++ b/crates/voelin-ui-vm/src/bbcode.rs @@ -36,9 +36,13 @@ pub const MAX_RUNS: usize = 1500; /// How a span of text looks. #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct Style { + /// Bold (`[b]`). pub bold: bool, + /// Italic (`[i]`). pub italic: bool, + /// Underlined (`[u]`). pub underline: bool, + /// Struck through (`[s]`). pub strike: bool, /// Code: on a background. pub code: bool, @@ -51,12 +55,16 @@ pub struct Style { /// A piece of a block. #[derive(Clone, Debug, PartialEq, Eq)] pub enum Span { + /// Text with one style. Text { + /// The characters. text: String, + /// How they look. style: Style, }, /// A picture at an address (`[img]…[/img]`). Image { + /// Where the picture is. url: String, }, } @@ -68,7 +76,10 @@ pub enum BlockKind { Text, /// A line of a quote; the first names who said it (`[quote=Name]`), when /// the quote does. - Quote { author: String }, + Quote { + /// Who said it, empty when the quote does not say. + author: String, + }, /// Code: all its lines in one span. Code, /// An item of a list. @@ -80,13 +91,16 @@ pub enum BlockKind { /// A line, a quote's line, code, a list item or a rule. #[derive(Clone, Debug, PartialEq, Eq)] pub struct Block { + /// What the block is. pub kind: BlockKind, + /// Its pieces, left to right. pub spans: Vec, } /// A message's text: its blocks, top to bottom. #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct Doc { + /// The lines, quotes, code and rules in order. pub blocks: Vec, } diff --git a/crates/voelin-ui-vm/src/bridge.rs b/crates/voelin-ui-vm/src/bridge.rs index 6dcdf21..1263f0f 100644 --- a/crates/voelin-ui-vm/src/bridge.rs +++ b/crates/voelin-ui-vm/src/bridge.rs @@ -5,6 +5,11 @@ //! (`bind/convert.rs`), the GPUI client will render them as they are. //! `MytsBadge` and `MytsForm` (account screens without a data source in this //! build) stay in Slint. +//! +//! The fields are not documented one by one: they are those of the Slint +//! structs, whose comments in `bridge.slint` explain them; the comments that +//! are here were carried over with them. +#![allow(missing_docs)] use std::sync::Arc; diff --git a/crates/voelin-ui-vm/src/chat.rs b/crates/voelin-ui-vm/src/chat.rs index e7c0b3c..0ff9905 100644 --- a/crates/voelin-ui-vm/src/chat.rs +++ b/crates/voelin-ui-vm/src/chat.rs @@ -24,7 +24,9 @@ const GROUP_MS: i64 = 5 * 60 * 1000; /// The author and time of the line before, for grouping. #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct Previous { + /// Who wrote it. pub author: String, + /// When, in milliseconds since the epoch. pub ts_ms: i64, } diff --git a/crates/voelin-ui-vm/src/emoji.rs b/crates/voelin-ui-vm/src/emoji.rs index 00af232..25e100d 100644 --- a/crates/voelin-ui-vm/src/emoji.rs +++ b/crates/voelin-ui-vm/src/emoji.rs @@ -298,7 +298,9 @@ pub fn first_key(text: &str) -> Option { /// A piece of text: plain, or one emoji (`emoji` is its key). #[derive(Clone, Debug, PartialEq, Eq)] pub struct Run { + /// The text: the word with its space, or the emoji's own characters. pub text: String, + /// The key of the Twemoji picture, none for plain text. pub emoji: Option, } diff --git a/crates/voelin-ui-vm/src/home.rs b/crates/voelin-ui-vm/src/home.rs index c0f2b3f..64563c2 100644 --- a/crates/voelin-ui-vm/src/home.rs +++ b/crates/voelin-ui-vm/src/home.rs @@ -18,9 +18,11 @@ pub enum ResumeAction { /// The card: the server, the channel and the button. #[derive(Clone, Debug, PartialEq, Eq)] pub struct Resume { + /// The id of the server's bookmark. pub bookmark: i64, /// The channel's path, its names from the top as the server has them. pub path: Vec, + /// What the button does. pub action: ResumeAction, } diff --git a/crates/voelin-ui-vm/src/lib.rs b/crates/voelin-ui-vm/src/lib.rs index 66e5969..dbf6aff 100644 --- a/crates/voelin-ui-vm/src/lib.rs +++ b/crates/voelin-ui-vm/src/lib.rs @@ -3,6 +3,13 @@ //! Neither Slint nor GPUI is a dependency; each front end converts these //! types (docs/ui.md, "Two crates"). +// Every public item is documented, except the fields of the two mirror +// modules (`bridge`, `studio_bridge`): their 400 or so fields are those of +// the Slint structs and are explained by the comments in `bridge.slint` and +// `studio-bridge.slint`, which stay the one place to read them until the +// Slint front end goes. +#![warn(missing_docs)] + pub mod avatar; pub mod bbcode; pub mod bridge; diff --git a/crates/voelin-ui-vm/src/servers.rs b/crates/voelin-ui-vm/src/servers.rs index fe4e8cd..598cc5d 100644 --- a/crates/voelin-ui-vm/src/servers.rs +++ b/crates/voelin-ui-vm/src/servers.rs @@ -126,6 +126,7 @@ pub fn form( pub struct ConnectTo { /// A channel path, or `/`. pub channel: Option, + /// The channel's password, if the form has one. pub channel_password: Option, /// A privilege key. pub token: Option, diff --git a/crates/voelin-ui-vm/src/settings.rs b/crates/voelin-ui-vm/src/settings.rs index 715b70e..56c66dd 100644 --- a/crates/voelin-ui-vm/src/settings.rs +++ b/crates/voelin-ui-vm/src/settings.rs @@ -31,8 +31,10 @@ pub static CLIENT_PLAYBACK: Key = Key::new( #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum ThemeChoice { + /// The dark palette. #[default] Dark, + /// The light palette. Light, /// The system's light or dark scheme. System, @@ -128,8 +130,11 @@ pub fn appearance_keys() -> [&'static dyn voelin_core::settings::Setting; 6] { #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum NotifyLevel { + /// Nothing. Off, + /// The bell in the app. App, + /// The bell and a desktop notification. #[default] Desktop, } @@ -294,6 +299,7 @@ pub struct UiSettings { pub openh264: bool, /// The ScreenCast portal's token for the last shared screen. pub portal_restore_token: Option, + /// The last choices in the share dialog. pub share: ShareDefaults, /// Write crash reports to disk (opt-in; never uploaded). pub crash_reports: bool, @@ -321,8 +327,11 @@ impl Default for UiSettings { /// path, its names from the top as the server has them. #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct LastVoice { + /// The id of the server's bookmark. pub bookmark: i64, + /// The address the bookmark had then. pub address: String, + /// The channel's names from the top. pub channel: Vec, } @@ -333,9 +342,13 @@ pub struct LastVoice { #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[serde(default)] pub struct ShareDefaults { + /// The frame rate's position in the old list ([`LEGACY_FPS_CHOICES`]). pub fps_index: usize, + /// The bitrate's position in the old list ([`LEGACY_BITRATE_CHOICES`]). pub bitrate_index: usize, + /// Share the sound too. pub audio: bool, + /// Accept the viewers that ask to watch without asking us. pub auto_accept: bool, } @@ -350,6 +363,7 @@ impl Default for ShareDefaults { pub struct ClientPlayback { /// Linear, 1 = unchanged. pub volume: f32, + /// Not played at all. pub muted: bool, } @@ -372,6 +386,7 @@ pub type ClientPlaybackMap = BTreeMap; /// Audio devices as listed in the settings: the system default first. #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct DeviceChoices { + /// What the list shows, by index. pub names: Vec, /// Device ids by index; `None` for the system default. pub ids: Vec>, diff --git a/crates/voelin-ui-vm/src/studio/mod.rs b/crates/voelin-ui-vm/src/studio/mod.rs index 2d7c1dd..0c501ef 100644 --- a/crates/voelin-ui-vm/src/studio/mod.rs +++ b/crates/voelin-ui-vm/src/studio/mod.rs @@ -117,6 +117,7 @@ pub fn audio_label(kind: &AudioSourceKindSetting) -> (String, String, &'static s pub struct AudioLive { /// Peak in dBFS. pub level: f32, + /// What went wrong with the source, if something did. pub error: Option, } @@ -502,7 +503,9 @@ pub fn placement(kind: &SourceKind, (w, h): (u32, u32)) -> Transform { /// (`None`: switched off, so it is removed). #[derive(Clone, Debug, PartialEq)] pub struct Overlay { + /// The source's name. pub name: &'static str, + /// What it shows, none to remove it. pub text: Option, } diff --git a/crates/voelin-ui-vm/src/studio_bridge.rs b/crates/voelin-ui-vm/src/studio_bridge.rs index 6daa15e..016bf5e 100644 --- a/crates/voelin-ui-vm/src/studio_bridge.rs +++ b/crates/voelin-ui-vm/src/studio_bridge.rs @@ -1,6 +1,8 @@ //! The Stream Studio's structs: the plain counterparts of //! `crates/voelin-ui/ui/studio-bridge.slint`, as [`crate::bridge`] has those of -//! `bridge.slint`. +//! `bridge.slint`. As there, the fields are not documented one by one: see the +//! comments in `studio-bridge.slint`. +#![allow(missing_docs)] use std::sync::Arc; diff --git a/crates/voelin-ui-vm/src/tree.rs b/crates/voelin-ui-vm/src/tree.rs index 146a569..031021a 100644 --- a/crates/voelin-ui-vm/src/tree.rs +++ b/crates/voelin-ui-vm/src/tree.rs @@ -56,11 +56,17 @@ pub fn badge_items(guids: &[String], pictures: &HashMap) -> Vec /// What the tree shows besides the presence. pub struct TreeInput<'a> { + /// The channels and clients of the server. pub presence: &'a Presence, + /// The channels folded shut. pub collapsed: &'a HashSet, + /// The clients that are talking. pub talking: &'a HashSet, + /// Local volume and mute of the clients we changed. pub playback: &'a ClientPlaybackMap, + /// The channel we are in. pub own_channel: Option, + /// Our own client. pub own_client: Option, /// Search text: only matching channels and clients (and the channels /// above them) are shown. Empty: everything.