refactor(lib): export the ConnectionType parse error and document what hosts can still match

This commit is contained in:
Michel de Graaf
2026-09-08 01:45:02 +02:00
parent 07dd163156
commit 976dd706d7
3 changed files with 4 additions and 6 deletions
+3 -3
View File
@@ -115,6 +115,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
``` ```
`ServerMessage` and `ClientOperation` are `#[non_exhaustive]`: every protocol `ClientOperation` is `#[non_exhaustive]`: every protocol message the client
message the client learns to handle adds a variant, so match them with a learns to handle adds a variant, so match it with a wildcard arm. `SharedFile`
wildcard arm. is too, so build it with the `..` syntax rather than listing every field.
-2
View File
@@ -21,9 +21,7 @@ use std::sync::mpsc::{Receiver, Sender};
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
/// Marked non-exhaustive: each peer message the client learns adds a variant.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[non_exhaustive]
pub enum PeerMessage { pub enum PeerMessage {
SendMessage(Message), SendMessage(Message),
FileSearchResult(SearchResult), FileSearchResult(SearchResult),
+1 -1
View File
@@ -34,7 +34,7 @@ pub use actor::server_actor::{PeerAddress, UserMessage};
pub use client::{Client, ClientSettings}; pub use client::{Client, ClientSettings};
pub use error::{Result, SoulseekRs}; pub use error::{Result, SoulseekRs};
pub use message::peer::{SharedDirectory, SharedFileEntry}; pub use message::peer::{SharedDirectory, SharedFileEntry};
pub use peer::ConnectionType; pub use peer::{ConnectionType, ParseConnectionTypeError};
pub use types::{ pub use types::{
ClientVersion, DownloadStatus, File, RoomEvent, RoomInfo, Search, ClientVersion, DownloadStatus, File, RoomEvent, RoomInfo, Search,
SearchResult, SessionLoss, Transfer, UploadInfo, UploadStatus, UserInfo, SearchResult, SessionLoss, Transfer, UploadInfo, UploadStatus, UserInfo,