pub trait MocInterface {
Show 20 methods
// Required methods
fn new(moc_path: String) -> Self;
fn info(&self) -> MocInfo;
fn clear_playlist(&mut self) -> bool;
fn play_playlist(&mut self) -> bool;
fn immediate_play(&mut self, source: MocSource) -> bool;
fn stop_server(&mut self) -> bool;
fn start_server(&mut self) -> bool;
fn next_song(&mut self) -> bool;
fn previous_song(&mut self) -> bool;
fn stop_playback(&mut self) -> bool;
fn pause_playback(&mut self) -> bool;
fn resume_playback(&mut self) -> bool;
fn set_volume(&mut self, vol: usize) -> bool;
fn increase_volume_by(&mut self, step: usize) -> bool;
fn decrease_volume_by(&mut self, step: usize) -> bool;
fn append_music(&mut self, path: &Path) -> bool;
fn seek(&mut self, step: isize) -> bool;
fn jump_to(&mut self, time: Duration) -> bool;
fn enable_control(&mut self, control: MocControl) -> bool;
fn disable_control(&mut self, control: MocControl) -> bool;
}
Expand description
The trait for most of this crate’s functionality, it exposes all the functions to interact with MoC.
Required Methods§
fn new(moc_path: String) -> Self
Sourcefn info(&self) -> MocInfo
fn info(&self) -> MocInfo
Get all the info about what MoC is currently doing, refer to
MocInfo
’s implementations for
the methods to get each field
Sourcefn clear_playlist(&mut self) -> bool
fn clear_playlist(&mut self) -> bool
Clear MoC’s current playlist.
Sourcefn play_playlist(&mut self) -> bool
fn play_playlist(&mut self) -> bool
Play MoC’s current playlist starting from the first item.
Sourcefn immediate_play(&mut self, source: MocSource) -> bool
fn immediate_play(&mut self, source: MocSource) -> bool
Immediately play the source
, it can be a file or stream url
but it has to be constructed using MocSource
.
Sourcefn stop_server(&mut self) -> bool
fn stop_server(&mut self) -> bool
Literally just game end
MoC.
Sourcefn start_server(&mut self) -> bool
fn start_server(&mut self) -> bool
Launch the MoC server
Sourcefn previous_song(&mut self) -> bool
fn previous_song(&mut self) -> bool
Go back to the previous song.
Sourcefn stop_playback(&mut self) -> bool
fn stop_playback(&mut self) -> bool
Stop all playback
Sourcefn pause_playback(&mut self) -> bool
fn pause_playback(&mut self) -> bool
Pause playback.
Sourcefn resume_playback(&mut self) -> bool
fn resume_playback(&mut self) -> bool
Resume playback.
Sourcefn set_volume(&mut self, vol: usize) -> bool
fn set_volume(&mut self, vol: usize) -> bool
Set the volume for MoC.
Sourcefn increase_volume_by(&mut self, step: usize) -> bool
fn increase_volume_by(&mut self, step: usize) -> bool
Instead of setting the volume, increase the volume by the step
.
Sourcefn decrease_volume_by(&mut self, step: usize) -> bool
fn decrease_volume_by(&mut self, step: usize) -> bool
Same as above but for decreasing.
Sourcefn append_music(&mut self, path: &Path) -> bool
fn append_music(&mut self, path: &Path) -> bool
Append a music file to the playlist, doesn’t support streams…
You could however clear the current playlist, write the stream url to
an m3u
file and load that file.
Sourcefn seek(&mut self, step: isize) -> bool
fn seek(&mut self, step: isize) -> bool
Seek forwards and backwards on the currently playing track, this doesn’t
jump to that duration, it seeks, therefore if you give the step the value of
-10
it seeks ten seconds back, for the value of 10
it seeks ten seconds
forwards
Sourcefn enable_control(&mut self, control: MocControl) -> bool
fn enable_control(&mut self, control: MocControl) -> bool
Enable one of the flags, refer to MocControl
Sourcefn disable_control(&mut self, control: MocControl) -> bool
fn disable_control(&mut self, control: MocControl) -> bool
Disable one of the flags, refer to MocControl
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.