examples: Update to derive_more 1.0

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1563>
This commit is contained in:
Sebastian Dröge 2024-10-19 17:30:28 +03:00 committed by GStreamer Marge Bot
parent e85cd35df4
commit 153d1bba16
22 changed files with 66 additions and 74 deletions

View file

@ -419,8 +419,7 @@ outdated:
- if: $CI_PIPELINE_SOURCE == "schedule"
script:
- cargo update --color=always
# Ignore derive_more until we can depend on Rust 1.75 or newer
- cargo outdated --color=always --root-deps-only --exit-code 1 -v --ignore derive_more
- cargo outdated --color=always --root-deps-only --exit-code 1 -v
coverage:
allow_failure: true

43
Cargo.lock generated
View file

@ -316,12 +316,6 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "convert_case"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "core-foundation"
version = "0.9.4"
@ -425,15 +419,23 @@ checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"
[[package]]
name = "derive_more"
version = "0.99.18"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce"
checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05"
dependencies = [
"derive_more-impl",
]
[[package]]
name = "derive_more-impl"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22"
dependencies = [
"convert_case",
"proc-macro2",
"quote",
"rustc_version",
"syn",
"unicode-xid",
]
[[package]]
@ -2135,15 +2137,6 @@ dependencies = [
"serde_derive",
]
[[package]]
name = "rustc_version"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
dependencies = [
"semver",
]
[[package]]
name = "rustix"
version = "0.38.37"
@ -2178,12 +2171,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]]
name = "semver"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]]
name = "serde"
version = "1.0.210"
@ -2467,6 +2454,12 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
[[package]]
name = "unicode-xid"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "version-compare"
version = "0.2.0"

View file

@ -28,7 +28,7 @@ gio = { workspace = true, optional = true }
anyhow = "1.0"
byte-slice-cast = "1"
cairo-rs = { workspace = true, features=["use_glib"], optional = true }
derive_more = "0.99.5"
derive_more = { version = "1", features = ["display", "error"] }
futures = "0.3"
# Since there's nothing Windows-specific to enable on gstreamer-rs, unconditionally enable glutin's WGL backend
glutin = { version = "0.31", optional = true, default-features = false, features = ["wgl"] }

View file

@ -12,14 +12,14 @@
use anyhow::Error;
use byte_slice_cast::*;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::{element_error, prelude::*};
#[path = "../examples-common.rs"]
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -11,7 +11,7 @@
// Video / BGRx (4 bytes) / 2 fps
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::prelude::*;
use gst_video::prelude::*;
@ -19,7 +19,7 @@ use gst_video::prelude::*;
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -35,14 +35,14 @@ use std::{
};
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::{element_error, element_warning, prelude::*};
#[path = "../examples-common.rs"]
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -11,14 +11,14 @@
use std::env;
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst_pbutils::{prelude::*, DiscovererInfo, DiscovererStreamInfo};
#[path = "../examples-common.rs"]
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Discoverer error {_0}")]
#[display("Discoverer error {_0}")]
struct DiscovererError(#[error(not(source))] &'static str);
fn print_tags(info: &DiscovererInfo) {

View file

@ -18,7 +18,7 @@ use std::{
};
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::{element_error, element_warning};
use gst_pbutils::prelude::*;
@ -26,7 +26,7 @@ use gst_pbutils::prelude::*;
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -10,7 +10,7 @@ use std::sync::{Arc, Mutex};
use byte_slice_cast::*;
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::prelude::*;
use windows::{
Foundation::Numerics::*,
@ -26,7 +26,7 @@ use windows::{
};
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {}: {} (debug: {:?})", src, error, debug)]
#[display("Received error from {}: {} (debug: {:?})", src, error, debug)]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -14,7 +14,7 @@ use std::{
};
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::prelude::*;
use pango::prelude::*;
@ -22,7 +22,7 @@ use pango::prelude::*;
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -17,7 +17,7 @@ use std::{
};
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::prelude::*;
use pango::prelude::*;
@ -25,7 +25,7 @@ use pango::prelude::*;
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -6,22 +6,22 @@ use gst::{element_error, prelude::*};
mod examples_common;
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
#[derive(Debug, Display, Error)]
#[display(fmt = "No such pad {_0} in {_1}")]
#[display("No such pad {_0} in {_1}")]
struct NoSuchPad(#[error(not(source))] &'static str, String);
#[derive(Debug, Display, Error)]
#[display(fmt = "Unknown payload type {_0}")]
#[display("Unknown payload type {_0}")]
struct UnknownPT(#[error(not(source))] u32);
#[derive(Debug, Display, Error)]
#[display(fmt = "Usage: {_0} (play | record) DROP_PROBABILITY")]
#[display("Usage: {_0} (play | record) DROP_PROBABILITY")]
struct UsageError(#[error(not(source))] String);
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -6,18 +6,18 @@ mod examples_common;
use std::env;
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
#[derive(Debug, Display, Error)]
#[display(fmt = "No such pad {_0} in {_1}")]
#[display("No such pad {_0} in {_1}")]
struct NoSuchPad(&'static str, String);
#[derive(Debug, Display, Error)]
#[display(fmt = "Usage: {_0} URI FEC_PERCENTAGE")]
#[display("Usage: {_0} URI FEC_PERCENTAGE")]
struct UsageError(#[error(not(source))] String);
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -5,14 +5,14 @@
#![allow(clippy::non_send_fields_in_send_ty)]
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst_rtsp_server::prelude::*;
#[path = "../examples-common.rs"]
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Could not get mount points")]
#[display("Could not get mount points")]
struct NoMountPoints;
fn main_loop() -> Result<(), Error> {

View file

@ -7,18 +7,18 @@
use std::env;
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst_rtsp_server::prelude::*;
#[path = "../examples-common.rs"]
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Could not get mount points")]
#[display("Could not get mount points")]
struct NoMountPoints;
#[derive(Debug, Display, Error)]
#[display(fmt = "Usage: {_0} LAUNCH_LINE")]
#[display("Usage: {_0} LAUNCH_LINE")]
struct UsageError(#[error(not(source))] String);
fn main_loop() -> Result<(), Error> {

View file

@ -9,14 +9,14 @@
#![allow(clippy::non_send_fields_in_send_ty)]
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst_rtsp_server::prelude::*;
#[path = "../examples-common.rs"]
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Could not get mount points")]
#[display("Could not get mount points")]
struct NoMountPoints;
fn main_loop() -> Result<(), Error> {

View file

@ -6,18 +6,18 @@
use std::env;
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst_rtsp_server::prelude::*;
#[path = "../examples-common.rs"]
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Could not get mount points")]
#[display("Could not get mount points")]
struct NoMountPoints;
#[derive(Debug, Display, Error)]
#[display(fmt = "Usage: {_0} LAUNCH_LINE")]
#[display("Usage: {_0} LAUNCH_LINE")]
struct UsageError(#[error(not(source))] String);
fn main_loop() -> Result<(), Error> {

View file

@ -8,7 +8,7 @@
#![allow(clippy::non_send_fields_in_send_ty)]
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::prelude::*;
#[path = "../examples-common.rs"]
@ -231,7 +231,7 @@ mod fir_filter {
}
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -19,18 +19,18 @@
// This merge-mode can also be supplied to any method that adds new tags.
use anyhow::{anyhow, Error};
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::prelude::*;
#[path = "../examples-common.rs"]
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Missing element {_0}")]
#[display("Missing element {_0}")]
struct MissingElement(#[error(not(source))] String);
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -8,7 +8,7 @@
// produce tightly packed pixels, and in case of RGBx never.
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::{element_error, prelude::*};
use gst_video::prelude::*;
@ -16,7 +16,7 @@ use gst_video::prelude::*;
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -20,14 +20,14 @@
use std::env;
use anyhow::Error;
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use gst::{element_error, prelude::*};
#[path = "../examples-common.rs"]
mod examples_common;
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,

View file

@ -15,7 +15,7 @@ use std::{
};
use anyhow::{Context, Result};
use derive_more::{Display, Error};
use derive_more::derive::{Display, Error};
use glutin::{
config::GetGlConfig as _,
context::AsRawContext as _,
@ -28,7 +28,7 @@ use gst_gl::prelude::*;
use raw_window_handle::HasRawWindowHandle as _;
#[derive(Debug, Display, Error)]
#[display(fmt = "Received error from {src}: {error} (debug: {debug:?})")]
#[display("Received error from {src}: {error} (debug: {debug:?})")]
struct ErrorMessage {
src: glib::GString,
error: glib::Error,