spice-client-glib 0.6.0

Rust bindings for the Spice client library
Documentation
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::{ffi, Session};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "SpiceAudio")]
    pub struct Audio(Object<ffi::SpiceAudio, ffi::SpiceAudioClass>);

    match fn {
        type_ => || ffi::spice_audio_get_type(),
    }
}

impl Audio {
    pub const NONE: Option<&'static Audio> = None;

    #[doc(alias = "spice_audio_get")]
    pub fn get(session: &Session, context: Option<&glib::MainContext>) -> Option<Audio> {
        skip_assert_initialized!();
        unsafe {
            from_glib_none(ffi::spice_audio_get(
                session.to_glib_none().0,
                context.to_glib_none().0,
            ))
        }
    }
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::Audio>> Sealed for T {}
}

pub trait AudioExt: IsA<Audio> + sealed::Sealed + 'static {
    #[doc(alias = "main-context")]
    fn main_context(&self) -> Option<glib::MainContext> {
        ObjectExt::property(self.as_ref(), "main-context")
    }

    fn session(&self) -> Option<Session> {
        ObjectExt::property(self.as_ref(), "session")
    }
}

impl<O: IsA<Audio>> AudioExt for O {}