common/types: add better alias for MountPath

This commit is contained in:
2025-11-25 04:27:20 +09:00
parent 9ca6544057
commit fdd4880d05
4 changed files with 13 additions and 11 deletions

View File

@@ -25,10 +25,10 @@ impl Command for Mount {
}
fn parse_request(mut parts: RequestTokenizer<'_>) -> RequestParserResult<'_> {
let path = parts
.next()
.ok_or(RequestParserError::UnexpectedEOF)?
.to_string();
let path = parts.next().ok_or(RequestParserError::UnexpectedEOF)?;
let path = path
.parse()
.map_err(|_| RequestParserError::SyntaxError(0, path.to_string()))?;
let uri = parts
.next()

View File

@@ -19,10 +19,10 @@ impl Command for Unmount {
}
fn parse_request(mut parts: RequestTokenizer<'_>) -> RequestParserResult<'_> {
let path = parts
.next()
.ok_or(RequestParserError::UnexpectedEOF)?
.to_string();
let path = parts.next().ok_or(RequestParserError::UnexpectedEOF)?;
let path = path
.parse()
.map_err(|_| RequestParserError::SyntaxError(0, path.to_string()))?;
debug_assert!(parts.next().is_none());

View File

@@ -14,6 +14,8 @@ mod time_interval;
mod volume_value;
mod window_range;
use std::path::PathBuf;
pub use absolute_relative_song_position::AbsouluteRelativeSongPosition;
pub use audio::Audio;
pub use bool_or_oneshot::BoolOrOneshot;
@@ -31,6 +33,7 @@ pub use volume_value::VolumeValue;
pub use window_range::WindowRange;
pub type AudioOutputId = u32;
pub type MountPath = PathBuf;
pub type Offset = u32;
pub type PlaylistName = String;
pub type PlaylistVersion = u32;
@@ -43,7 +46,6 @@ pub type TimeWithFractions = f64;
// TODO: use a proper types
pub type Feature = String;
pub type PartitionName = String;
pub type Path = String;
pub type StickerType = String;
pub type TagName = String;
pub type TagValue = String;

View File

@@ -130,8 +130,8 @@ pub enum Request {
Rescan(Option<Uri>),
// -- Mount and Neighbor Commands -- //
Mount(Path, Uri),
Unmount(Path),
Mount(MountPath, Uri),
Unmount(MountPath),
ListMounts,
ListNeighbors,