Commit graph

44 commits

Author SHA1 Message Date
Sebastian Dröge afe2b18018 gstreamer/iterator: Store filter types in a hash table
Static variables in generic functions only exist once and not once per
type parameter, so before we were only able to register exactly one
filter type.
2020-06-08 12:23:20 +03:00
Sebastian Dröge 5479b23eb9 Use mem::ManuallyDrop instead of mem::forget() everywhere
It makes the intentions clearer and potentially results in simpler
assembly, at least in debug builds.
2020-04-30 10:56:38 +03:00
Sebastian Dröge 671605d8ac Minor cleanup in various places 2020-03-09 22:49:51 +02:00
Sebastian Dröge 2ba5105b80 Implement Sync/Send for more types and don't implement Send for TypeFind
They can actually be shared with multiple threads at the same time
safely as all functions requiring an immutable reference are
thread-safe.

OTOH TypeFind can't be shared safely between different threads as not
all implementations of the TypeFind struct are thread-safe.
2019-12-18 18:37:44 +02:00
François Laignel dc7937a8d4 Don't leak missing Safety doc clippy warnings
With rustc 1.40.0, clippy checks that the `unsafe` functions come with
a `Safety` section. When running clippy on a downstream crate, the
macros such as `gst_plugin_define!` leak the clippy warnings for the
unsafe functions.

Silence the warnings for now.
2019-11-18 10:25:06 +01:00
Sebastian Dröge 043af60126 iterator: Fix leak of the closure in Iterator::filter() 2019-11-13 12:18:21 +01:00
Jan Alexander Steffens (heftig) eaacee49de
iterator: Simplify StdIterator a bit 2019-09-24 11:31:28 +02:00
Jan Alexander Steffens (heftig) 105412b5a0
Iterator: Test that Iterator can be used in a for loop
`for x in foo` depends on foo implementing IntoIterator.
2019-09-05 11:01:16 +02:00
Jan Alexander Steffens (heftig) 7a12c4d5e1
Iterator: Replace ad-hoc fn iter with impl IntoIterator
std has a trait for converting things into Iterators. Make use of it.
2019-09-05 10:33:54 +02:00
Jan Alexander Steffens (heftig) a30935ad1f
Iterator: Add a wrapper implementing std's Iterator
Transposing the item type lets us be a std-compatible Iterator.

The iterator is automatically resynced when resuming iteration after
yielding Resync. This lets some combinators like `collect` and `find`
work properly.
2019-09-04 14:34:05 +02:00
Jan Alexander Steffens (heftig) db61ec4a6b
Iterator: Manually implement Debug
The derived implementation is restricted to `where T: Debug`, but the
iterator doesn't actually contain a value of type T.
2019-09-04 14:34:04 +02:00
François Laignel 514a05accd Manual update for new Value::get signature 2019-08-13 10:57:32 +02:00
Sebastian Dröge f63d50546a Don't use ONCE_INIT anymore now that Once::new() is const 2019-07-11 17:56:50 +03:00
Sebastian Dröge d1e562b9f6 Explicitly add dyn keyword to trait objects
Trait objects without are deprecated with the latest nightly and this
makes it more clear that we're doing dynamic dispatch anyway.
2019-06-06 09:09:34 +03:00
Sebastian Dröge e7898c1b24 Update manual code 2019-04-15 19:19:19 +03:00
Sebastian Dröge 86a31b4139 Silence/fix various clippy warnings 2019-03-07 14:05:35 +02:00
Sebastian Dröge 8c39da4e5b Update to Rust 1.31 linter-specific attributes 2019-03-04 15:16:01 +02:00
Sebastian Dröge 42a8b9e505 Get rid of double-boxing for some other closures 2019-01-30 13:02:41 +00:00
Sebastian Dröge bd0cbe99b3 Add more Debug impls to everything possible 2019-01-22 17:46:08 +02:00
Sebastian Dröge eb0a804a50 Run everything through latest rustfmt 2018-10-08 15:02:23 +03:00
Sebastian Dröge a6d9fe4b0a Remove std::iter::Iterator impl from gst::Iterator
It does not work well with possibly errors during iteration and
requiring to possibly resync.
2018-08-13 20:35:28 +03:00
Sebastian Dröge dba110e8ad Fix build with two-phase-borrows/NLL 2018-08-08 09:16:18 +02:00
Sebastian Dröge 33a6aab6d7 Run everything through latest rustfmt 2018-07-27 13:36:40 +03:00
Sebastian Dröge 694bcaa697 Fix all clippy warnings
Or silence the ones we don't care about.
2018-07-20 10:28:20 +03:00
Sebastian Dröge e0972ae1e5 Get rid of manual usage of callback_guard! 2018-06-24 14:52:50 +03:00
Sebastian Dröge 2cefd9aea6 Re-run everything through rustfmt 2018-04-25 11:13:14 +03:00
Sebastian Dröge 492c3d656c Run everything through rustfmt again 2018-04-01 11:57:58 +03:00
Sebastian Dröge fca0287dec Use ptr::NonNull in various places 2018-04-01 11:29:55 +03:00
Sebastian Dröge a3b294f0f2 Add back callback guards 2018-03-02 21:34:29 +02:00
Sebastian Dröge f1426c82ba Remove callback guards
Since Rust 1.24 it is safe to let panics go to the FFI boundary
2018-02-17 19:58:41 +02:00
Sebastian Dröge 9b6efb2339 Fix various clippy warnings 2017-12-20 21:46:58 +02:00
Sebastian Dröge f7c971874d Implement Display and Error for IteratorError 2017-12-16 17:48:38 +02:00
Sebastian Dröge 1f80df493a Let the glib::Value destructor clean up our values instead of doing so manually 2017-12-06 11:17:59 +02:00
Sebastian Dröge 8c697b3a27 Use Arc::clone(&val) instead of val.clone() to make it more explicit that only the Arc cloned here 2017-11-27 14:03:33 +02:00
Sebastian Dröge 3179806f01 Regenerate everything with latest GIR
And fix-up manual code
2017-11-05 19:08:39 +02:00
Sebastian Dröge e1d134c4be Run everything through latest rustfmt-nightly 2017-10-17 12:06:51 +03:00
Sebastian Dröge 191b90b1df Add copyright/license header to iterator.rs 2017-09-17 18:50:35 +03:00
Sebastian Dröge ce5c01a88e Implement gst::Iterator as a generic type to not require using glib::Values everywhere 2017-09-17 18:45:38 +03:00
Sebastian Dröge 8085c4ce8e Add gst::Iterator example with Resync handling 2017-09-17 14:59:01 +03:00
Sebastian Dröge f7bce553cd Implement std::iter::Iterator<Item=Result<glib::Value, IteratorError> for gst::Iterator 2017-09-17 14:43:33 +03:00
Sebastian Dröge 8306e5cf72 Add more complete gst::Iterator bindings
filter(), foreach(), find(), fold() are implemented now and we can
create our own iterators from a Vec<_> or by implementing a new trait.
2017-09-17 13:31:34 +03:00
Sebastian Dröge 85b335fd89 Fix/hide various clippy warnings in gstreamer 2017-09-10 15:21:26 +03:00
Sebastian Dröge 03285a6311 Run everything through latest rustfmt-nightly 2017-07-31 12:16:42 +01:00
Sebastian Dröge 4730500662 Add Iterator bindings 2017-07-29 14:37:06 +01:00