Adapt to no longer re-exported traits

Some of the traits were moved to prelude or translate
and no longer in the main scope of the crate

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1382>
This commit is contained in:
Bilal Elmoussaoui 2024-02-03 09:13:51 +01:00
parent cfc1aed3c3
commit aaea288abf
57 changed files with 97 additions and 94 deletions

View file

@ -51,7 +51,7 @@ impl<T: IirFilterImpl> IirFilterImplExt for T {}
/// Class struct for `IirFilter`. /// Class struct for `IirFilter`.
#[repr(C)] #[repr(C)]
pub struct Class { pub struct Class {
parent: <<imp::IirFilter as ObjectSubclass>::ParentType as glib::ObjectType>::GlibClassType, parent: <<imp::IirFilter as ObjectSubclass>::ParentType as ObjectType>::GlibClassType,
set_rate: fn(&IirFilter, rate: u32), set_rate: fn(&IirFilter, rate: u32),
} }

View file

@ -3,7 +3,7 @@ use std::{
os::unix::prelude::{IntoRawFd, RawFd}, os::unix::prelude::{IntoRawFd, RawFd},
}; };
use glib::{translate::*, Cast}; use glib::{prelude::*, translate::*};
use gst::{Memory, MemoryRef}; use gst::{Memory, MemoryRef};
#[cfg(feature = "v1_16")] #[cfg(feature = "v1_16")]

View file

@ -1,6 +1,6 @@
use std::{fmt, mem, os::unix::prelude::IntoRawFd}; use std::{fmt, mem, os::unix::prelude::IntoRawFd};
use glib::{translate::*, Cast}; use glib::{prelude::*, translate::*};
use gst::{Memory, MemoryRef}; use gst::{Memory, MemoryRef};
use crate::{DRMDumbAllocator, DmaBufMemory}; use crate::{DRMDumbAllocator, DmaBufMemory};

View file

@ -1,6 +1,6 @@
use std::{fmt, os::unix::prelude::RawFd}; use std::{fmt, os::unix::prelude::RawFd};
use glib::{translate::*, Cast}; use glib::{prelude::*, translate::*};
use gst::{Memory, MemoryRef}; use gst::{Memory, MemoryRef};
use crate::{FdAllocator, FdMemoryFlags}; use crate::{FdAllocator, FdMemoryFlags};

View file

@ -5,7 +5,7 @@ use std::mem::transmute;
use glib::object::Cast; use glib::object::Cast;
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
use glib::signal::{connect_raw, SignalHandlerId}; use glib::signal::{connect_raw, SignalHandlerId};
use glib::{object::IsA, translate::*}; use glib::translate::*;
use gst::prelude::*; use gst::prelude::*;
use crate::auto::{AudioAggregator, AudioAggregatorPad}; use crate::auto::{AudioAggregator, AudioAggregatorPad};
@ -31,14 +31,14 @@ pub trait AudioAggregatorExtManual: sealed::Sealed + IsA<AudioAggregator> + 'sta
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "output-buffer-duration-fraction")] #[doc(alias = "output-buffer-duration-fraction")]
fn output_buffer_duration_fraction(&self) -> gst::Fraction { fn output_buffer_duration_fraction(&self) -> gst::Fraction {
glib::ObjectExt::property(self.as_ref(), "output-buffer-duration-fraction") ObjectExt::property(self.as_ref(), "output-buffer-duration-fraction")
} }
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "output-buffer-duration-fraction")] #[doc(alias = "output-buffer-duration-fraction")]
fn set_output_buffer_duration_fraction(&self, output_buffer_duration_fraction: gst::Fraction) { fn set_output_buffer_duration_fraction(&self, output_buffer_duration_fraction: gst::Fraction) {
glib::ObjectExt::set_property( ObjectExt::set_property(
self.as_ref(), self.as_ref(),
"output-buffer-duration-fraction", "output-buffer-duration-fraction",
output_buffer_duration_fraction, output_buffer_duration_fraction,

View file

@ -1,10 +1,9 @@
use std::mem::transmute; use std::mem::transmute;
use glib::{ use glib::{
object::IsA, prelude::*,
signal::{connect_raw, SignalHandlerId}, signal::{connect_raw, SignalHandlerId},
translate::*, translate::*,
Cast,
}; };
use crate::auto::AudioAggregatorConvertPad; use crate::auto::AudioAggregatorConvertPad;
@ -19,13 +18,13 @@ pub trait AudioAggregatorConvertPadExtManual:
{ {
#[doc(alias = "converter-config")] #[doc(alias = "converter-config")]
fn converter_config(&self) -> Option<crate::AudioConverterConfig> { fn converter_config(&self) -> Option<crate::AudioConverterConfig> {
glib::ObjectExt::property::<Option<gst::Structure>>(self.as_ref(), "converter-config") ObjectExt::property::<Option<gst::Structure>>(self.as_ref(), "converter-config")
.map(|c| c.try_into().unwrap()) .map(|c| c.try_into().unwrap())
} }
#[doc(alias = "converter-config")] #[doc(alias = "converter-config")]
fn set_converter_config(&self, converter_config: Option<&crate::AudioConverterConfig>) { fn set_converter_config(&self, converter_config: Option<&crate::AudioConverterConfig>) {
glib::ObjectExt::set_property( ObjectExt::set_property(
self.as_ref(), self.as_ref(),
"converter-config", "converter-config",
converter_config.map(|s| s.as_ref()), converter_config.map(|s| s.as_ref()),

View file

@ -2,7 +2,7 @@
use std::{mem, slice}; use std::{mem, slice};
use glib::{translate::*, value::FromValue, StaticType, ToValue, Type}; use glib::{prelude::*, translate::*, value::FromValue, Type};
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive] #[non_exhaustive]

View file

@ -3,8 +3,8 @@
use std::{cmp::Ordering, fmt, marker::PhantomData, str}; use std::{cmp::Ordering, fmt, marker::PhantomData, str};
use glib::{ use glib::{
prelude::*,
translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut}, translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut},
StaticType,
}; };
#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)] #[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]

View file

@ -1,8 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{ use glib::{
prelude::*,
translate::{from_glib, ToGlibPtr}, translate::{from_glib, ToGlibPtr},
FlagsClass, StaticType, ToValue, FlagsClass,
}; };
use gst::bitflags_serde_impl; use gst::bitflags_serde_impl;

View file

@ -1,8 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{ use glib::{
prelude::*,
translate::{from_glib, ToGlibPtr}, translate::{from_glib, ToGlibPtr},
FlagsClass, StaticType, ToValue, FlagsClass,
}; };
use gst::bitflags_serde_impl; use gst::bitflags_serde_impl;

View file

@ -1,8 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{ use glib::{
prelude::*,
translate::{from_glib, ToGlibPtr}, translate::{from_glib, ToGlibPtr},
FlagsClass, StaticType, ToValue, FlagsClass,
}; };
use gst::bitflags_serde_impl; use gst::bitflags_serde_impl;

View file

@ -1,6 +1,5 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::object::IsA;
use gst::prelude::*; use gst::prelude::*;
use crate::{auto::AudioVisualizer, subclass::AudioVisualizerSetupToken}; use crate::{auto::AudioVisualizer, subclass::AudioVisualizerSetupToken};

View file

@ -2,7 +2,7 @@
use std::fmt; use std::fmt;
use glib::Cast; use glib::prelude::*;
use crate::{DiscovererAudioInfo, DiscovererStreamInfo}; use crate::{DiscovererAudioInfo, DiscovererStreamInfo};

View file

@ -2,7 +2,7 @@
use std::fmt; use std::fmt;
use glib::Cast; use glib::prelude::*;
use crate::{DiscovererStreamInfo, DiscovererSubtitleInfo}; use crate::{DiscovererStreamInfo, DiscovererSubtitleInfo};

View file

@ -2,7 +2,7 @@
use std::fmt; use std::fmt;
use glib::{translate::*, Cast}; use glib::{prelude::*, translate::*};
use crate::{DiscovererStreamInfo, DiscovererVideoInfo}; use crate::{DiscovererStreamInfo, DiscovererVideoInfo};

View file

@ -1,8 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{ use glib::{
prelude::*,
translate::{from_glib, ToGlibPtr}, translate::{from_glib, ToGlibPtr},
FlagsClass, StaticType, ToValue, FlagsClass,
}; };
use gst::bitflags_serde_impl; use gst::bitflags_serde_impl;

View file

@ -3,9 +3,9 @@
use std::{boxed::Box as Box_, mem::transmute}; use std::{boxed::Box as Box_, mem::transmute};
use glib::{ use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId}, signal::{connect_raw, SignalHandlerId},
translate::*, translate::*,
ObjectType,
}; };
use crate::PlaySignalAdapter; use crate::PlaySignalAdapter;

View file

@ -1,8 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{ use glib::{
prelude::*,
translate::{from_glib, ToGlibPtr}, translate::{from_glib, ToGlibPtr},
FlagsClass, StaticType, ToValue, FlagsClass,
}; };
use gst::{bitflags_deserialize_impl, bitflags_serde_impl, bitflags_serialize_impl}; use gst::{bitflags_deserialize_impl, bitflags_serde_impl, bitflags_serialize_impl};

View file

@ -1,8 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{ use glib::{
prelude::*,
translate::{from_glib, ToGlibPtr}, translate::{from_glib, ToGlibPtr},
FlagsClass, StaticType, ToValue, FlagsClass,
}; };
use gst::bitflags_serde_impl; use gst::bitflags_serde_impl;

View file

@ -5,7 +5,7 @@ use std::{
ptr::{self, addr_of}, ptr::{self, addr_of},
}; };
use glib::{translate::*, ObjectType}; use glib::{prelude::*, translate::*};
use gst_rtsp::{rtsp_message::RTSPMessage, RTSPUrl}; use gst_rtsp::{rtsp_message::RTSPMessage, RTSPUrl};
use crate::{RTSPClient, RTSPSession, RTSPToken}; use crate::{RTSPClient, RTSPSession, RTSPToken};

View file

@ -1,8 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{ use glib::{
prelude::*,
translate::{from_glib, ToGlibPtr}, translate::{from_glib, ToGlibPtr},
FlagsClass, StaticType, ToValue, FlagsClass,
}; };
use gst::bitflags_serde_impl; use gst::bitflags_serde_impl;

View file

@ -6,7 +6,7 @@ use std::{
fmt, mem, ops, ptr, fmt, mem, ops, ptr,
}; };
use glib::{translate::*, StaticType}; use glib::{prelude::*, translate::*};
use crate::{ use crate::{
sdp_attribute::SDPAttribute, sdp_attribute::SDPAttribute,

View file

@ -1,6 +1,6 @@
use std::ops::{Bound::*, RangeBounds}; use std::ops::{Bound::*, RangeBounds};
use glib::IntoGStr; use glib::translate::*;
use gst::Caps; use gst::Caps;
use crate::VideoFormat; use crate::VideoFormat;

View file

@ -1,8 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{ use glib::{
prelude::*,
translate::{from_glib, ToGlibPtr}, translate::{from_glib, ToGlibPtr},
FlagsClass, StaticType, ToValue, FlagsClass,
}; };
use gst::bitflags_serde_impl; use gst::bitflags_serde_impl;

View file

@ -1,4 +1,4 @@
use glib::{object::IsA, translate::*}; use glib::translate::*;
use gst::prelude::*; use gst::prelude::*;
use crate::auto::VideoAggregator; use crate::auto::VideoAggregator;

View file

@ -1,10 +1,9 @@
use std::mem::transmute; use std::mem::transmute;
use glib::{ use glib::{
object::IsA, prelude::*,
signal::{connect_raw, SignalHandlerId}, signal::{connect_raw, SignalHandlerId},
translate::*, translate::*,
Cast,
}; };
use crate::auto::VideoAggregatorConvertPad; use crate::auto::VideoAggregatorConvertPad;
@ -19,13 +18,13 @@ pub trait VideoAggregatorConvertPadExtManual:
{ {
#[doc(alias = "converter-config")] #[doc(alias = "converter-config")]
fn converter_config(&self) -> Option<crate::VideoConverterConfig> { fn converter_config(&self) -> Option<crate::VideoConverterConfig> {
glib::ObjectExt::property::<Option<gst::Structure>>(self.as_ref(), "converter-config") ObjectExt::property::<Option<gst::Structure>>(self.as_ref(), "converter-config")
.map(|c| c.try_into().unwrap()) .map(|c| c.try_into().unwrap())
} }
#[doc(alias = "converter-config")] #[doc(alias = "converter-config")]
fn set_converter_config(&self, converter_config: Option<&crate::VideoConverterConfig>) { fn set_converter_config(&self, converter_config: Option<&crate::VideoConverterConfig>) {
glib::ObjectExt::set_property( ObjectExt::set_property(
self.as_ref(), self.as_ref(),
"converter-config", "converter-config",
converter_config.map(|s| s.as_ref()), converter_config.map(|s| s.as_ref()),

View file

@ -1,7 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use std::mem; use std::mem;
use glib::{translate::*, ToSendValue}; use glib::{prelude::*, translate::*};
use gst::EventType; use gst::EventType;
#[cfg(feature = "v1_22")] #[cfg(feature = "v1_22")]

View file

@ -4,7 +4,7 @@ use std::ptr;
use glib::{ use glib::{
translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr}, translate::{from_glib, from_glib_full, IntoGlib, ToGlibPtr},
ToSendValue, value::ToSendValue,
}; };
use gst::{ffi as gst_ffi, prelude::*, Message, Object, Seqnum}; use gst::{ffi as gst_ffi, prelude::*, Message, Object, Seqnum};

View file

@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{translate::*, Cast, IsA}; use glib::{prelude::*, translate::*};
use crate::Allocator; use crate::Allocator;

View file

@ -2,11 +2,7 @@
use std::{fmt, marker::PhantomData, ptr, str}; use std::{fmt, marker::PhantomData, ptr, str};
use glib::{ use glib::{prelude::*, translate::*, value::ToSendValue};
translate::{from_glib, from_glib_full, FromGlibPtrFull, IntoGlib, IntoGlibPtr, ToGlibPtr},
value::ToSendValue,
IntoGStr, StaticType,
};
use crate::{caps_features::*, structure::*, CapsIntersectMode}; use crate::{caps_features::*, structure::*, CapsIntersectMode};

View file

@ -9,7 +9,7 @@ use std::{
ptr, str, ptr, str,
}; };
use glib::{translate::*, IntoGStr, StaticType}; use glib::{prelude::*, translate::*};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
#[doc(alias = "GstCapsFeatures")] #[doc(alias = "GstCapsFeatures")]
@ -854,7 +854,7 @@ mod tests {
#[test] #[test]
fn test_from_value_optional() { fn test_from_value_optional() {
use glib::ToValue; use glib::value::ToValue;
crate::init().unwrap(); crate::init().unwrap();

View file

@ -4,8 +4,8 @@
use glib::{ use glib::{
translate::{FromGlib, IntoGlib}, translate::{FromGlib, IntoGlib},
types::StaticType,
value::{ToValue, ToValueOptional}, value::{ToValue, ToValueOptional},
StaticType,
}; };
use serde::{ use serde::{
de::{Deserialize, Deserializer, Error}, de::{Deserialize, Deserializer, Error},

View file

@ -3,9 +3,10 @@
use std::{cmp, ops}; use std::{cmp, ops};
use glib::{ use glib::{
prelude::*,
translate::*, translate::*,
value::{FromValue, ToValue, Value}, value::{FromValue, ToValue, Value},
StaticType, Type, Type,
}; };
use thiserror::Error; use thiserror::Error;

View file

@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{prelude::*, IntoGStr}; use glib::{prelude::*, translate::*};
use thiserror::Error; use thiserror::Error;
#[macro_export] #[macro_export]

View file

@ -1,8 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{ use glib::{
prelude::*,
translate::{from_glib, ToGlibPtr}, translate::{from_glib, ToGlibPtr},
FlagsClass, StaticType, ToValue, FlagsClass,
}; };
bitflags_serde_impl!(crate::BinFlags); bitflags_serde_impl!(crate::BinFlags);

View file

@ -6,7 +6,8 @@ use std::{
time::Duration, time::Duration,
}; };
use glib::{translate::*, StaticType}; use crate::prelude::*;
use glib::translate::*;
use super::{ use super::{
Format, FormattedValue, FormattedValueError, FormattedValueFullRange, FormattedValueIntrinsic, Format, FormattedValue, FormattedValueError, FormattedValueFullRange, FormattedValueIntrinsic,
@ -527,14 +528,14 @@ impl From<ClockTime> for glib::Value {
} }
#[doc(hidden)] #[doc(hidden)]
impl glib::StaticType for ClockTime { impl StaticType for ClockTime {
#[inline] #[inline]
fn static_type() -> glib::Type { fn static_type() -> glib::Type {
<u64 as glib::StaticType>::static_type() <u64 as StaticType>::static_type()
} }
} }
impl glib::HasParamSpec for ClockTime { impl HasParamSpec for ClockTime {
type ParamSpec = glib::ParamSpecUInt64; type ParamSpec = glib::ParamSpecUInt64;
type SetValue = Self; type SetValue = Self;
type BuilderFn = fn(&str) -> glib::ParamSpecUInt64Builder; type BuilderFn = fn(&str) -> glib::ParamSpecUInt64Builder;

View file

@ -64,7 +64,7 @@ impl PluginApiExt for glib::Type {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use glib::StaticType; use glib::prelude::StaticType;
use super::*; use super::*;

View file

@ -4,9 +4,10 @@ use std::{any::Any, fmt, iter, marker::PhantomData, mem, ptr, sync::Arc};
use glib::{ use glib::{
ffi::{gconstpointer, gpointer}, ffi::{gconstpointer, gpointer},
prelude::*,
translate::*, translate::*,
value::{FromValue, ToValue}, value::{FromValue, ToValue},
StaticType, Value, Value,
}; };
use thiserror::Error; use thiserror::Error;

View file

@ -2,7 +2,7 @@
use std::{borrow::Cow, ffi::CStr, fmt, ptr}; use std::{borrow::Cow, ffi::CStr, fmt, ptr};
use glib::{ffi::gpointer, prelude::*, translate::*, IntoGStr, IntoOptionalGStr}; use glib::{ffi::gpointer, prelude::*, translate::*};
use libc::c_char; use libc::c_char;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
@ -746,7 +746,7 @@ macro_rules! log_with_level(
#[allow(unused_unsafe)] #[allow(unused_unsafe)]
#[allow(clippy::redundant_closure_call)] #[allow(clippy::redundant_closure_call)]
if cat.above_threshold($level) { if cat.above_threshold($level) {
use $crate::glib::Cast; use $crate::glib::prelude::Cast;
// FIXME: Once there's a function_name! macro that returns a string literal we can // FIXME: Once there's a function_name! macro that returns a string literal we can
// directly pass it as `&GStr` forward // directly pass it as `&GStr` forward
@ -789,7 +789,7 @@ macro_rules! log_with_level(
// formatted arguments are evaluated even if we end up not logging. // formatted arguments are evaluated even if we end up not logging.
#[allow(unused_unsafe)] #[allow(unused_unsafe)]
if cat.above_threshold($level) { if cat.above_threshold($level) {
use $crate::glib::Cast; use $crate::glib::prelude::Cast;
// FIXME: Once there's a function_name! macro that returns a string literal we can // FIXME: Once there's a function_name! macro that returns a string literal we can
// directly pass it as `&GStr` forward // directly pass it as `&GStr` forward
@ -814,7 +814,7 @@ macro_rules! log_with_level(
#[allow(unused_unsafe)] #[allow(unused_unsafe)]
#[allow(clippy::redundant_closure_call)] #[allow(clippy::redundant_closure_call)]
if cat.above_threshold($level) { if cat.above_threshold($level) {
use $crate::glib::Cast; use $crate::glib::prelude::Cast;
// FIXME: Once there's a function_name! macro that returns a string literal we can // FIXME: Once there's a function_name! macro that returns a string literal we can
// directly pass it as `&GStr` forward // directly pass it as `&GStr` forward
@ -858,7 +858,7 @@ macro_rules! log_with_level(
// formatted arguments are evaluated even if we end up not logging. // formatted arguments are evaluated even if we end up not logging.
#[allow(unused_unsafe)] #[allow(unused_unsafe)]
if cat.above_threshold($level) { if cat.above_threshold($level) {
use $crate::glib::Cast; use $crate::glib::prelude::Cast;
// FIXME: Once there's a function_name! macro that returns a string literal we can // FIXME: Once there's a function_name! macro that returns a string literal we can
// directly pass it as `&GStr` forward // directly pass it as `&GStr` forward

View file

@ -595,7 +595,7 @@ pub struct MemoryTypeValueTypeChecker<M>(PhantomData<M>);
unsafe impl<M> glib::value::ValueTypeChecker for MemoryTypeValueTypeChecker<M> unsafe impl<M> glib::value::ValueTypeChecker for MemoryTypeValueTypeChecker<M>
where where
M: MemoryType + glib::StaticType, M: MemoryType + glib::prelude::StaticType,
<M as crate::prelude::IsMiniObject>::RefType: AsRef<MemoryRef> + AsMut<MemoryRef>, <M as crate::prelude::IsMiniObject>::RefType: AsRef<MemoryRef> + AsMut<MemoryRef>,
{ {
type Error = glib::value::ValueTypeMismatchOrNoneError<MemoryTypeMismatchError>; type Error = glib::value::ValueTypeMismatchOrNoneError<MemoryTypeMismatchError>;
@ -875,7 +875,7 @@ macro_rules! memory_object_wrapper {
} }
fn value_type(&self) -> glib::Type { fn value_type(&self) -> glib::Type {
<Self as glib::StaticType>::static_type() <Self as $crate::glib::prelude::StaticType>::static_type()
} }
} }

View file

@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{translate::*, StaticType}; use glib::{prelude::*, translate::*};
use std::{alloc, mem, ptr}; use std::{alloc, mem, ptr};

View file

@ -350,7 +350,6 @@ impl Error {
pub fn builder_from_error<'a>(error: glib::Error) -> ErrorBuilder<'a> { pub fn builder_from_error<'a>(error: glib::Error) -> ErrorBuilder<'a> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
use glib::error::ErrorDomain;
assert!([ assert!([
crate::CoreError::domain(), crate::CoreError::domain(),
crate::ResourceError::domain(), crate::ResourceError::domain(),
@ -443,8 +442,6 @@ impl Warning {
pub fn builder_from_error<'a>(error: glib::Error) -> WarningBuilder<'a> { pub fn builder_from_error<'a>(error: glib::Error) -> WarningBuilder<'a> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
use glib::error::ErrorDomain;
assert!([ assert!([
crate::CoreError::domain(), crate::CoreError::domain(),
crate::ResourceError::domain(), crate::ResourceError::domain(),
@ -537,8 +534,6 @@ impl Info {
pub fn builder_from_error<'a>(error: glib::Error) -> InfoBuilder<'a> { pub fn builder_from_error<'a>(error: glib::Error) -> InfoBuilder<'a> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
use glib::error::ErrorDomain;
assert!([ assert!([
crate::CoreError::domain(), crate::CoreError::domain(),
crate::ResourceError::domain(), crate::ResourceError::domain(),

View file

@ -2,6 +2,7 @@
use std::fmt; use std::fmt;
use crate::prelude::*;
use glib::translate::*; use glib::translate::*;
pub trait IsMiniObject: pub trait IsMiniObject:
@ -570,7 +571,7 @@ macro_rules! mini_object_wrapper (
#[inline] #[inline]
fn value_type(&self) -> $crate::glib::Type { fn value_type(&self) -> $crate::glib::Type {
<Self as $crate::glib::StaticType>::static_type() <Self as $crate::glib::prelude::StaticType>::static_type()
} }
} }
@ -617,7 +618,7 @@ macro_rules! mini_object_wrapper (
// Can't have SetValue/SetValueOptional impls as otherwise one could use it to get // Can't have SetValue/SetValueOptional impls as otherwise one could use it to get
// immutable references from a mutable reference without borrowing via the value // immutable references from a mutable reference without borrowing via the value
impl $crate::glib::HasParamSpec for $name { impl $crate::glib::prelude::HasParamSpec for $name {
type ParamSpec = $crate::glib::ParamSpecBoxed; type ParamSpec = $crate::glib::ParamSpecBoxed;
type SetValue = Self; type SetValue = Self;
type BuilderFn = fn(&str) -> $crate::glib::ParamSpecBoxedBuilder<Self>; type BuilderFn = fn(&str) -> $crate::glib::ParamSpecBoxedBuilder<Self>;
@ -639,7 +640,7 @@ mini_object_wrapper!(MiniObject, MiniObjectRef, ffi::GstMiniObject, || {
impl MiniObject { impl MiniObject {
#[inline] #[inline]
pub fn downcast<T: IsMiniObject + glib::StaticType>(self) -> Result<T, Self> { pub fn downcast<T: IsMiniObject + StaticType>(self) -> Result<T, Self> {
if self.type_().is_a(T::static_type()) { if self.type_().is_a(T::static_type()) {
unsafe { Ok(from_glib_full(self.into_glib_ptr() as *mut T::FfiType)) } unsafe { Ok(from_glib_full(self.into_glib_ptr() as *mut T::FfiType)) }
} else { } else {
@ -670,7 +671,7 @@ impl MiniObjectRef {
} }
#[inline] #[inline]
pub fn downcast_ref<T: IsMiniObject + glib::StaticType>(&self) -> Option<&T::RefType> { pub fn downcast_ref<T: IsMiniObject + StaticType>(&self) -> Option<&T::RefType> {
if self.type_().is_a(T::static_type()) { if self.type_().is_a(T::static_type()) {
unsafe { Some(&*(self as *const Self as *const T::RefType)) } unsafe { Some(&*(self as *const Self as *const T::RefType)) }
} else { } else {
@ -679,7 +680,7 @@ impl MiniObjectRef {
} }
#[inline] #[inline]
pub fn downcast_mut<T: IsMiniObject + glib::StaticType>(&mut self) -> Option<&mut T::RefType> { pub fn downcast_mut<T: IsMiniObject + StaticType>(&mut self) -> Option<&mut T::RefType> {
if self.type_().is_a(T::static_type()) { if self.type_().is_a(T::static_type()) {
unsafe { Some(&mut *(self as *mut Self as *mut T::RefType)) } unsafe { Some(&mut *(self as *mut Self as *mut T::RefType)) }
} else { } else {

View file

@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::{gobject_ffi, translate::*, ParamSpec}; use glib::{gobject_ffi, prelude::*, translate::*, ParamSpec};
glib::wrapper! { glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -26,9 +26,9 @@ impl std::ops::Deref for ParamSpecFraction {
} }
} }
unsafe impl glib::ParamSpecType for ParamSpecFraction {} unsafe impl ParamSpecType for ParamSpecFraction {}
impl glib::HasParamSpec for crate::Fraction { impl HasParamSpec for crate::Fraction {
type ParamSpec = ParamSpecFraction; type ParamSpec = ParamSpecFraction;
type SetValue = crate::Fraction; type SetValue = crate::Fraction;
@ -222,9 +222,9 @@ impl std::ops::Deref for ParamSpecArray {
} }
} }
unsafe impl glib::ParamSpecType for ParamSpecArray {} unsafe impl ParamSpecType for ParamSpecArray {}
impl glib::HasParamSpec for crate::Array { impl HasParamSpec for crate::Array {
type ParamSpec = ParamSpecArray; type ParamSpec = ParamSpecArray;
type SetValue = crate::Array; type SetValue = crate::Array;

View file

@ -44,7 +44,7 @@ impl StaticType for Rank {
} }
} }
impl glib::HasParamSpec for Rank { impl HasParamSpec for Rank {
type ParamSpec = glib::ParamSpecEnum; type ParamSpec = glib::ParamSpecEnum;
type SetValue = Self; type SetValue = Self;
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;

View file

@ -2,7 +2,7 @@
use std::{fmt, marker::PhantomData, mem}; use std::{fmt, marker::PhantomData, mem};
use glib::{translate::*, StaticType}; use glib::{prelude::*, translate::*};
use crate::{ use crate::{
format::{ format::{

View file

@ -2,7 +2,7 @@
use std::{fmt, marker::PhantomData, ptr}; use std::{fmt, marker::PhantomData, ptr};
use glib::{translate::*, StaticType}; use glib::{prelude::*, translate::*};
use crate::Caps; use crate::Caps;
@ -31,7 +31,7 @@ impl fmt::Debug for StaticCaps {
} }
} }
impl glib::types::StaticType for StaticCaps { impl StaticType for StaticCaps {
#[inline] #[inline]
fn static_type() -> glib::types::Type { fn static_type() -> glib::types::Type {
unsafe { glib::translate::from_glib(ffi::gst_static_caps_get_type()) } unsafe { glib::translate::from_glib(ffi::gst_static_caps_get_type()) }

View file

@ -2,7 +2,7 @@
use std::{ffi::CStr, fmt, marker::PhantomData, ptr}; use std::{ffi::CStr, fmt, marker::PhantomData, ptr};
use glib::{translate::*, StaticType}; use glib::{prelude::*, translate::*};
use crate::{Caps, PadTemplate}; use crate::{Caps, PadTemplate};

View file

@ -1205,7 +1205,7 @@ mod tests {
#[test] #[test]
fn test_from_value_optional() { fn test_from_value_optional() {
use glib::ToValue; use glib::value::ToValue;
crate::init().unwrap(); crate::init().unwrap();

View file

@ -4,7 +4,7 @@
use std::fmt; use std::fmt;
use glib::{Date, ToValue}; use glib::{value::ToValue, Date};
use serde::{ use serde::{
de, de,
de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor}, de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor},

View file

@ -3,9 +3,9 @@
use std::ptr; use std::ptr;
use glib::{ use glib::{
prelude::*,
subclass::{prelude::*, InitializingObject}, subclass::{prelude::*, InitializingObject},
translate::*, translate::*,
Cast, StaticType,
}; };
use libc::c_char; use libc::c_char;

View file

@ -37,11 +37,11 @@ macro_rules! panic_to_error(
{ {
let panicked = $imp.panicked(); let panicked = $imp.panicked();
let element = $crate::glib::subclass::types::ObjectSubclassExt::obj($imp); let element = $crate::glib::subclass::types::ObjectSubclassExt::obj($imp);
let element = unsafe { $crate::glib::Cast::unsafe_cast_ref::<$crate::Element>(element.as_ref()) }; let element = unsafe { $crate::glib::prelude::Cast::unsafe_cast_ref::<$crate::Element>(element.as_ref()) };
if panicked.load(std::sync::atomic::Ordering::Relaxed) { if panicked.load(std::sync::atomic::Ordering::Relaxed) {
$crate::subclass::post_panic_error_message( $crate::subclass::post_panic_error_message(
element, element,
$crate::glib::Cast::upcast_ref::<$crate::Object>(element), $crate::glib::prelude::Cast::upcast_ref::<$crate::Object>(element),
None, None,
); );
$ret $ret
@ -54,7 +54,7 @@ macro_rules! panic_to_error(
panicked.store(true, std::sync::atomic::Ordering::Relaxed); panicked.store(true, std::sync::atomic::Ordering::Relaxed);
$crate::subclass::post_panic_error_message( $crate::subclass::post_panic_error_message(
element, element,
$crate::glib::Cast::upcast_ref::<$crate::Object>(element), $crate::glib::prelude::Cast::upcast_ref::<$crate::Object>(element),
Some(err), Some(err),
); );
$ret $ret

View file

@ -3,9 +3,9 @@
use std::{fmt, marker::PhantomData, mem}; use std::{fmt, marker::PhantomData, mem};
use glib::{ use glib::{
prelude::*,
translate::*, translate::*,
value::{FromValue, SendValue, ToSendValue, Value}, value::{FromValue, SendValue, ToSendValue, Value},
IntoGStr, StaticType,
}; };
use crate::{Sample, TagError, TagMergeMode, TagScope}; use crate::{Sample, TagError, TagMergeMode, TagScope};

View file

@ -6,7 +6,8 @@ use std::{cell::RefCell, cmp, fmt, rc::Rc};
use glib::{ use glib::{
translate::{from_glib, ToGlibPtr}, translate::{from_glib, ToGlibPtr},
Date, SendValue, ToValue, value::{SendValue, ToValue},
Date,
}; };
use serde::{ use serde::{
de, de,

View file

@ -1,5 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use glib::prelude::*;
// rustdoc-stripper-ignore-next // rustdoc-stripper-ignore-next
/// Trait that allows accessing `Display` implementation on types external to this crate. /// Trait that allows accessing `Display` implementation on types external to this crate.
pub trait Displayable { pub trait Displayable {
@ -16,13 +18,12 @@ pub struct ObjectLockGuard<'a, T: ?Sized> {
impl<'a, T> ObjectLockGuard<'a, T> impl<'a, T> ObjectLockGuard<'a, T>
where where
T: glib::IsA<crate::Object> + ?Sized, T: IsA<crate::Object> + ?Sized,
{ {
#[inline] #[inline]
pub fn acquire(obj: &'a T) -> ObjectLockGuard<'a, T> { pub fn acquire(obj: &'a T) -> ObjectLockGuard<'a, T> {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
use glib::ObjectType;
let mutex = &mut (*obj.as_ref().as_ptr()).lock; let mutex = &mut (*obj.as_ref().as_ptr()).lock;
glib::ffi::g_mutex_lock(mutex); glib::ffi::g_mutex_lock(mutex);
Self { obj, mutex } Self { obj, mutex }

View file

@ -2,7 +2,7 @@
use std::{cmp, fmt, ops, slice}; use std::{cmp, fmt, ops, slice};
use glib::{translate::*, StaticType}; use glib::{prelude::*, translate::*};
use num_rational::Rational32; use num_rational::Rational32;
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] #[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]

View file

@ -4,7 +4,7 @@
use std::{fmt, mem}; use std::{fmt, mem};
use glib::{Date, StaticType, ToValue}; use glib::{prelude::*, Date};
use num_rational::Rational32; use num_rational::Rational32;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use serde::{ use serde::{