diff --git a/soulseek-rs-lib/src/actor/mod.rs b/soulseek-rs-lib/src/actor/mod.rs index d9eb252..eed1cfd 100644 --- a/soulseek-rs-lib/src/actor/mod.rs +++ b/soulseek-rs-lib/src/actor/mod.rs @@ -52,7 +52,7 @@ impl ActorHandle { } /// Internal actor message wrapper -pub(crate) enum ActorMessage { +pub enum ActorMessage { UserMessage(M), Stop, } diff --git a/soulseek-rs-lib/src/actor/peer_actor.rs b/soulseek-rs-lib/src/actor/peer_actor.rs index bf63e3a..dba864a 100644 --- a/soulseek-rs-lib/src/actor/peer_actor.rs +++ b/soulseek-rs-lib/src/actor/peer_actor.rs @@ -21,7 +21,9 @@ use std::sync::mpsc::{Receiver, Sender}; use std::sync::{Arc, RwLock}; use std::time::{Duration, Instant}; +/// Marked non-exhaustive: each peer message the client learns adds a variant. #[derive(Debug, Clone)] +#[non_exhaustive] pub enum PeerMessage { SendMessage(Message), FileSearchResult(SearchResult), diff --git a/soulseek-rs-lib/src/lib.rs b/soulseek-rs-lib/src/lib.rs index 3fb0fba..20a0d66 100644 --- a/soulseek-rs-lib/src/lib.rs +++ b/soulseek-rs-lib/src/lib.rs @@ -2,14 +2,17 @@ // example in it, so a signature change cannot leave the advertised usage stale. #![doc = include_str!("../README.md")] -// Core modules -pub mod actor; +// The public surface is the client, its types, the wire codec and the share +// index. The actors, dispatcher, peer plumbing and download store are how the +// client is built, not what a host programs against, so they stay inside the +// crate and a change to them is not a change to the library's API. +pub(crate) mod actor; pub mod client; -pub mod dispatcher; -pub mod download_store; +pub(crate) mod dispatcher; +pub(crate) mod download_store; pub mod error; pub mod message; -pub mod peer; +pub(crate) mod peer; pub mod shares; pub mod types; #[macro_use] @@ -31,6 +34,7 @@ pub use actor::server_actor::{PeerAddress, UserMessage}; pub use client::{Client, ClientSettings}; pub use error::{Result, SoulseekRs}; pub use message::peer::{SharedDirectory, SharedFileEntry}; +pub use peer::ConnectionType; pub use types::{ ClientVersion, DownloadStatus, File, RoomEvent, RoomInfo, Search, SearchResult, SessionLoss, Transfer, UploadInfo, UploadStatus, UserInfo, diff --git a/soulseek-rs-lib/src/peer/mod.rs b/soulseek-rs-lib/src/peer/mod.rs index 586320d..301603c 100644 --- a/soulseek-rs-lib/src/peer/mod.rs +++ b/soulseek-rs-lib/src/peer/mod.rs @@ -3,10 +3,9 @@ pub mod listen; pub mod upload_peer; // Export actor types -pub use crate::actor::peer_actor::{PeerActor, PeerMessage}; -pub use crate::actor::peer_registry::PeerRegistry; +pub use crate::actor::peer_actor::PeerMessage; -pub(crate) use download_peer::part_path_of; +pub use download_peer::part_path_of; pub use download_peer::{DownloadError, DownloadPeer}; use crate::message::Message; diff --git a/soulseek-rs-lib/src/shares/mod.rs b/soulseek-rs-lib/src/shares/mod.rs index 65dfcd2..fb85657 100644 --- a/soulseek-rs-lib/src/shares/mod.rs +++ b/soulseek-rs-lib/src/shares/mod.rs @@ -12,7 +12,11 @@ use std::io; use std::path::{Path, PathBuf}; /// One shared file: its peer-facing virtual path and where it lives on disk. +/// +/// Built by the scan, never by a host, so fields can be added without a +/// breaking release. #[derive(Debug, Clone)] +#[non_exhaustive] pub struct SharedFile { /// Backslash-separated path exposed to peers, e.g. `music\album\song.mp3`. pub virtual_path: String, diff --git a/soulseek-rs-lib/tests/e2e.rs b/soulseek-rs-lib/tests/e2e.rs index 2701379..f6ec4ea 100644 --- a/soulseek-rs-lib/tests/e2e.rs +++ b/soulseek-rs-lib/tests/e2e.rs @@ -24,10 +24,9 @@ use std::time::{Duration, Instant}; use soulseek_rs::message::Message; use soulseek_rs::message::server::MessageFactory; -use soulseek_rs::peer::ConnectionType; use soulseek_rs::{ - Client, ClientSettings, ClientVersion, DownloadStatus, PeerAddress, - SessionLoss, UploadStatus, + Client, ClientSettings, ClientVersion, ConnectionType, DownloadStatus, + PeerAddress, SessionLoss, UploadStatus, }; /// Only one test at a time may drive a server. diff --git a/soulseek-rs/src/cli.rs b/soulseek-rs/src/cli.rs index 7b96954..ad2e2cf 100644 --- a/soulseek-rs/src/cli.rs +++ b/soulseek-rs/src/cli.rs @@ -172,7 +172,11 @@ pub struct Cli { pub log_file: Option, } +/// Non-exhaustive: this enum is public through the crate's library target so +/// the integration tests can reach it, and a new subcommand must not read as a +/// breaking change of that library. #[derive(Subcommand, Debug)] +#[non_exhaustive] pub enum Commands { /// Search the network and print matching files Search(SearchArgs), @@ -254,6 +258,7 @@ pub struct DaemonArgs { } #[derive(Subcommand, Debug)] +#[non_exhaustive] pub enum DaemonCommand { /// Print the token remote clients authenticate with Token, @@ -266,6 +271,7 @@ pub enum DaemonCommand { } #[derive(Subcommand, Debug)] +#[non_exhaustive] pub enum CompletionsCommand { /// Write the completion script where the shell looks for it Install(CompletionsArgs),