Struct MpvInitializer

Source
pub struct MpvInitializer { /* private fields */ }
Expand description

Context passed to the initializer of Mpv::with_initialzer.

Implementations§

Source§

impl MpvInitializer

Source

pub fn set_property<T: SetData>(&self, name: &str, data: T) -> Result<()>

Set a property to a given value. Properties are essentially variables which can be queried or set at runtime. For example, writing to the pause property will actually pause or unpause playback.

Will return Err If the format T doesn’t match with the internal format of the property and it also fails to convert to T or if setting properties not backed by options.

Source

pub fn set_option<T: SetData>(&self, name: &str, data: T) -> Result<()>

Set the value of an option

Source

pub fn load_config(&self, path: &str) -> Result<()>

Load a config file. This loads and parses the file, and sets every entry in the config file’s default section as if MpvInitializer::set_option() is called.

The filename should be an absolute path. If it isn’t, the actual path used is unspecified.

Will return Err if the file wasn’t found or if a fatal error happens when parsing a config file.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.