pub struct MocInfo { /* private fields */ }
Expand description
A big struct holding an extreme amount of data.
This struct represents all data relating to the
mocp --info
command and since MoC can omit
certain things while outputting some fields can
be empty, for example, if the state is MocState::Stopped
the rest will be empty, for playing streams the total_time
field will be empty and there will only be a current_time
field
Implementations§
Source§impl MocInfo
impl MocInfo
Sourcepub fn state(&self) -> MocState
pub fn state(&self) -> MocState
Get the state from a MocInfo
struct, all the other methods
that don’t have the parameter called with
do the same for other fields aswell.
Sourcepub fn with_state(self, with: MocState) -> Self
pub fn with_state(self, with: MocState) -> Self
Builder-style function to compose a MocInfo
struct, this and
all the other functions that take a with
parameter can also be used the same way…
For example:
use moc_rs::common::{MocInfo, MocState};
let mocinfo = MocInfo::default()
.with_state(MocState::Playing)
.with_full_title("Wayfinder & Phace - Hymn (-)".into())
.with_artist("Wayfinder & Phace".into())
.with_title("Hymn".into())
.with_album("-".into());
// All other values will be left as default in this case
pub fn file(&self) -> MocSource
pub fn with_file(self, with: MocSource) -> Self
pub fn full_title(&self) -> String
pub fn with_full_title(self, with: String) -> Self
pub fn artist(&self) -> String
pub fn with_artist(self, with: String) -> Self
pub fn title(&self) -> String
pub fn with_title(self, with: String) -> Self
pub fn album(&self) -> String
pub fn with_album(self, with: String) -> Self
pub fn total_time(&self) -> Duration
pub fn with_total_time(self, with: Duration) -> Self
pub fn current_time(&self) -> Duration
pub fn with_current_time(self, with: Duration) -> Self
pub fn bitrate(&self) -> String
pub fn with_bitrate(self, with: String) -> Self
pub fn avg_bitrate(&self) -> String
pub fn with_avg_bitrate(self, with: String) -> Self
pub fn rate(&self) -> String
pub fn with_rate(self, with: String) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MocInfo
impl RefUnwindSafe for MocInfo
impl Send for MocInfo
impl Sync for MocInfo
impl Unpin for MocInfo
impl UnwindSafe for MocInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more