Commit graph

37 commits

Author SHA1 Message Date
Sebastian Dröge be3c378f28 Use Results instead of Options where they signal an error instead of just a missing value
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/216
2019-12-17 22:21:28 +02:00
Sebastian Dröge 107ae588f2 examples: Fix various clippy warnings 2019-10-04 11:01:55 +03:00
Sebastian Dröge 06cfcd57fc Move to_string() methods into the Display trait or rename to to_str(), move from_string() into the FromStr trait
Fixes clippy warnings, prevents confusing errors and is more consistent.

The Display trait provides a to_string() method by itself and FromStr
provides from_str().
2019-10-04 11:01:55 +03:00
Sebastian Dröge 8618085d46 Port examples/tutorials to the explicit Option parameter changes 2019-04-15 19:19:19 +03:00
François Laignel 948fb2ae4b Replace XXXReturn with Result<XXXSuccess, XXXError>
... in function signatures.

These breaking changes aim at improving usability by allowing users
to take advantage of Rust error management features sur as `ok_or`,
`map_err`, `expect` and the `?` operator. See the `examples` and
`tutorials` to get an idea of the impacts.
2019-01-11 18:33:04 +01:00
Philippe Normand bef6d741d3 Fix examples and tutorials for GString support 2019-01-03 22:01:41 +00:00
Sebastian Dröge 69af6a5975 bus: Add iter() and iter_timed() that return Iterators around the corresponding pop() functions
And make use of them in the examples where it makes sense.
2018-12-28 00:06:03 +02:00
Markus Ebner 466e02df3a Add verbose documentation to the examples
Added verbose documentation to all of the repository's examples.
2018-11-29 19:59:57 +01:00
Sebastian Dröge 8a6bcbcedb Run through rustfmt once again 2018-10-28 13:47:02 +00:00
Sebastian Dröge eb0a804a50 Run everything through latest rustfmt 2018-10-08 15:02:23 +03:00
Sebastian Dröge 2c7dff3b45 Run everything through rustfmt again 2018-10-08 09:32:08 +03:00
Sebastian Dröge 33a6aab6d7 Run everything through latest rustfmt 2018-07-27 13:36:40 +03:00
Sebastian Dröge c0422acf66 Fix reference cycles and minor related problems in all examples and tutorials
These are now all leak-free.
2018-07-27 13:07:24 +03:00
Sebastian Dröge 8d0a0ee6b1 Directly use byte-slice-cast on the mapped buffer
No need to first get a byte slice from it anymore due to the buffer map
implementing AsRef/AsMut for byte slices
2018-06-01 11:55:13 +03:00
Sebastian Dröge 492c3d656c Run everything through rustfmt again 2018-04-01 11:57:58 +03:00
Sebastian Dröge 4117c01ff2 Run everything through latest rustfmt-nightly 2018-02-22 11:18:37 +01:00
fengalin 21c687f256 Examples: message handlers: invoke generic Message method from the concrete message
Generic methods for events, messages and queries can now be invoked from the concrete type.
2018-01-29 17:33:49 +02:00
Sebastian Dröge 396dae666f Make appsink/appsrc callbacks builder more consistent with other code
Move the constructor of the builder to the main type
2017-12-16 11:37:00 +02:00
Sebastian Dröge 49a6eb6a1f Replace AppSrcCallbacks/AppSinkCallbacks with a builder so that no empty closures have to be provided for unused callbacks 2017-12-10 15:19:44 +02:00
Sebastian Dröge b6d13272df Fix some clippy warnings in examples/tutorials 2017-11-27 14:03:33 +02:00
Sebastian Dröge f895f484cc Fix up tutorials and examples for Message::get_src() returning an Option now 2017-11-16 13:58:56 +02:00
Sebastian Dröge a01f1385ec examples: Set up a runloop on macOS 2017-11-12 19:07:02 +01:00
Sebastian Dröge c9027fb244 Switch appsrc example to failure based error handling 2017-11-12 10:15:37 +01:00
Sebastian Dröge eb99694ed3 Minor cleanup of appsink example 2017-11-11 16:56:37 +01:00
Sebastian Dröge 90700aa9b2 Switch appsink example to failure based error handling 2017-11-11 16:43:29 +01:00
Sebastian Dröge f1025170d9 Use while-let and CLOCK_TIME_NONE for the bus.timed_pop() loops in the examples/tutorials 2017-09-13 19:35:35 +03:00
Sebastian Dröge 0f5f55c64d Fix various clippy warnings in examples 2017-09-10 15:27:53 +03:00
Sebastian Dröge 062b596432 Fix-up various unused external crate warnings 2017-09-01 13:42:59 +03:00
Sebastian Dröge f751afc0fb Add prelude modules to all cratest that only re-export the traits
And use those in the examples instead of blanket * imports
2017-08-17 18:02:25 +03:00
Sebastian Dröge 56847216a0 Use byte-slice-cast trait instead of our own minimal version of it 2017-08-14 20:45:35 +03:00
Sebastian Dröge b655c838b2 Add helper for converting a raw audio buffer to an array of integers/floats 2017-08-11 17:09:32 +03:00
Sebastian Dröge 1a3b556fb6 Make Buffer map bindings more simple and consistent 2017-08-11 15:20:43 +03:00
Sebastian Dröge c9423471b0 Fix some clippy warnings in the examples 2017-08-04 15:36:12 +03:00
Philippe Normand 7326377f5f examples: app*: refactor error enum to a utils module
The module also contains create_element, link_elements and set_state functions
to help reduce boilerplate.
2017-08-04 15:09:29 +03:00
Philippe Normand e218f7a93c examples: appsink: improved error handling
The program should now exit gracefully with human readable messages.
2017-08-03 19:48:26 +03:00
Sebastian Dröge b08a101cc6 Fix clippy warnings in the examples 2017-08-02 20:15:16 +03:00
Sebastian Dröge 594418e1f4 Add appsink example 2017-08-01 21:45:26 +03:00