1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use glib::{bitflags::bitflags, prelude::*, translate::*};
use std::fmt;

bitflags! {
    /// A set of flags for information of the pair of streams.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "ALSARawmidiStreamPairInfoFlag")]
    pub struct StreamPairInfoFlag: u32 {
        /// The pair of stream supports output substream.
        #[doc(alias = "ALSARAWMIDI_STREAM_PAIR_INFO_FLAG_OUTPUT")]
        const OUTPUT = ffi::ALSARAWMIDI_STREAM_PAIR_INFO_FLAG_OUTPUT as _;
        /// The pair of stream supports input substream.
        #[doc(alias = "ALSARAWMIDI_STREAM_PAIR_INFO_FLAG_INPUT")]
        const INPUT = ffi::ALSARAWMIDI_STREAM_PAIR_INFO_FLAG_INPUT as _;
        /// Both directions of stream are available at the same time.
        #[doc(alias = "ALSARAWMIDI_STREAM_PAIR_INFO_FLAG_DUPLEX")]
        const DUPLEX = ffi::ALSARAWMIDI_STREAM_PAIR_INFO_FLAG_DUPLEX as _;
    }
}

impl fmt::Display for StreamPairInfoFlag {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for StreamPairInfoFlag {
    type GlibType = ffi::ALSARawmidiStreamPairInfoFlag;

    #[inline]
    fn into_glib(self) -> ffi::ALSARawmidiStreamPairInfoFlag {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::ALSARawmidiStreamPairInfoFlag> for StreamPairInfoFlag {
    #[inline]
    unsafe fn from_glib(value: ffi::ALSARawmidiStreamPairInfoFlag) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for StreamPairInfoFlag {
    #[inline]
    #[doc(alias = "alsarawmidi_stream_pair_info_flag_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::alsarawmidi_stream_pair_info_flag_get_type()) }
    }
}

impl glib::HasParamSpec for StreamPairInfoFlag {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder
    }
}

impl glib::value::ValueType for StreamPairInfoFlag {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for StreamPairInfoFlag {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for StreamPairInfoFlag {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<StreamPairInfoFlag> for glib::Value {
    #[inline]
    fn from(v: StreamPairInfoFlag) -> Self {
        ToValue::to_value(&v)
    }
}