gstreamer_analytics/
enums.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3#[cfg(feature = "v1_28")]
4use crate::ffi;
5#[cfg(feature = "v1_28")]
6use crate::TensorDataType;
7
8#[cfg(feature = "v1_28")]
9use glib::translate::*;
10
11#[cfg(feature = "v1_28")]
12impl TensorDataType {
13    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
14    #[doc(alias = "gst_tensor_data_type_get_name")]
15    pub fn name<'a>(self) -> &'a glib::GStr {
16        unsafe {
17            glib::GStr::from_ptr(
18                ffi::gst_tensor_data_type_get_name(self.into_glib())
19                    .as_ref()
20                    .expect("gst_tensor_data_type_get_name returned NULL"),
21            )
22        }
23    }
24}
25
26#[cfg(feature = "v1_28")]
27#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
28impl std::fmt::Display for TensorDataType {
29    #[inline]
30    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
31        f.write_str(self.name())
32    }
33}