Struct MpvIpc

Source
pub struct MpvIpc { /* private fields */ }

Implementations§

Source§

impl MpvIpc

Source

pub async fn connect(ipc_path: &PathBuf) -> Result<Self>

Attach to an existing mpv IPC socket.

Source

pub async fn spawn(opt: &MpvSpawnOptions) -> Result<Self>

Spawn a new mpv process and attach to it.

Source

pub async fn running(&self) -> bool

Source

pub async fn send_command(&mut self, cmd: Value) -> Result<Value>

Send a command to mpv and wait for a reply. This should not be used to quit because it will never receive a reply. Use the quit function instead.

Source

pub async fn quit(&mut self)

Shuts down the mpv player and disconnects.

Source

pub async fn disconnect(&mut self)

Disconnect from the IPC socket.

Source

pub async fn get_prop<T: DeserializeOwned>(&mut self, name: &str) -> Result<T>

Source

pub async fn set_prop( &mut self, name: &str, value: impl Serialize, ) -> Result<()>

Source

pub async fn watch_event<A, F, Fut>( &mut self, name: impl AsRef<str> + 'static + Send + Sync + Serialize + Display, callback: F, )
where for<'a> Fut: Future<Output = A> + Send + 'a, for<'a> F: Fn(Value) -> Fut + Send + 'a,

Source

pub async fn observe_prop<T: 'static + Send + Sync + Clone + DeserializeOwned>( &mut self, name: impl AsRef<str> + 'static + Send + Sync + Serialize + Display, default: T, ) -> Receiver<T>

Trait Implementations§

Source§

impl Drop for MpvIpc

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for MpvIpc

§

impl !RefUnwindSafe for MpvIpc

§

impl Send for MpvIpc

§

impl Sync for MpvIpc

§

impl Unpin for MpvIpc

§

impl !UnwindSafe for MpvIpc

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.