From 8fa1076dfa2a65affa342322734e49ac2ee4ec27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 17 Jan 2022 19:34:06 +0200 Subject: [PATCH] Replace `Foo::from_instance(foo)` with `foo.imp()` --- examples/src/bin/subclass.rs | 2 +- gstreamer/src/subclass/element.rs | 2 +- gstreamer/src/subclass/pad.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/src/bin/subclass.rs b/examples/src/bin/subclass.rs index 5cd885590..c716f4258 100644 --- a/examples/src/bin/subclass.rs +++ b/examples/src/bin/subclass.rs @@ -236,7 +236,7 @@ mod fir_filter { // Sets the coefficients by getting access to the private // struct and simply setting them pub fn set_coeffs(&self, coeffs: Vec) { - let imp = imp::FirFilter::from_instance(self); + let imp = self.imp(); *imp.coeffs.lock().unwrap() = coeffs; } } diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index 30040ce92..b7cfd4ed8 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -821,7 +821,7 @@ mod tests { pipeline.set_state(crate::State::Null).unwrap(); - let imp = imp::TestElement::from_instance(&element); + let imp = element.imp(); assert_eq!(imp.n_buffers.load(atomic::Ordering::SeqCst), 100); assert!(imp.reached_playing.load(atomic::Ordering::SeqCst)); } diff --git a/gstreamer/src/subclass/pad.rs b/gstreamer/src/subclass/pad.rs index 48d03ecfd..b81085687 100644 --- a/gstreamer/src/subclass/pad.rs +++ b/gstreamer/src/subclass/pad.rs @@ -150,7 +150,7 @@ mod tests { pad.link(&otherpad).unwrap(); pad.unlink(&otherpad).unwrap(); - let imp = imp::TestPad::from_instance(&pad); + let imp = pad.imp(); assert!(imp.linked.load(atomic::Ordering::SeqCst)); assert!(imp.unlinked.load(atomic::Ordering::SeqCst)); }