mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-09-03 18:33:51 +00:00
Merge branch 'paste-pastey' into 'main'
gstreamer: Switch from paste to pastey Closes #557 See merge request gstreamer/gstreamer-rs!1779
This commit is contained in:
commit
6182dd8c54
4 changed files with 38 additions and 4 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -894,7 +894,7 @@ dependencies = [
|
||||||
"num-integer",
|
"num-integer",
|
||||||
"num-rational",
|
"num-rational",
|
||||||
"option-operations",
|
"option-operations",
|
||||||
"paste",
|
"pastey",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"ron",
|
"ron",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -2268,6 +2268,12 @@ version = "1.0.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pastey"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "percent-encoding"
|
name = "percent-encoding"
|
||||||
version = "2.3.1"
|
version = "2.3.1"
|
||||||
|
|
|
@ -29,7 +29,7 @@ muldiv = "1"
|
||||||
opt-ops = { package = "option-operations", version = "0.5" }
|
opt-ops = { package = "option-operations", version = "0.5" }
|
||||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||||
serde_bytes = { version = "0.11", optional = true }
|
serde_bytes = { version = "0.11", optional = true }
|
||||||
paste = "1.0"
|
pastey = "0.1"
|
||||||
thiserror = "2"
|
thiserror = "2"
|
||||||
smallvec = { version = "1.0", features = ["write"] }
|
smallvec = { version = "1.0", features = ["write"] }
|
||||||
itertools = "0.14"
|
itertools = "0.14"
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
// Re-exported for the subclass gst_plugin_define! macro
|
// Re-exported for the subclass gst_plugin_define! macro
|
||||||
pub use glib;
|
pub use glib;
|
||||||
pub use gstreamer_sys as ffi;
|
pub use gstreamer_sys as ffi;
|
||||||
pub use paste;
|
#[deprecated = "Use `gst::pastey` instead"]
|
||||||
|
pub use pastey as paste;
|
||||||
|
pub use pastey;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
|
pub static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
|
||||||
|
|
|
@ -42,10 +42,12 @@ macro_rules! plugin_define(
|
||||||
// NB: if this looks a lot like `Option`, it is not a coincidence. Alas,
|
// NB: if this looks a lot like `Option`, it is not a coincidence. Alas,
|
||||||
// Option::or is not `const` and neither is `unwrap_or` so we have to roll our
|
// Option::or is not `const` and neither is `unwrap_or` so we have to roll our
|
||||||
// own oli-obk-ified enum instead.
|
// own oli-obk-ified enum instead.
|
||||||
|
#[allow(unused)]
|
||||||
enum OptionalPtr<T>{
|
enum OptionalPtr<T>{
|
||||||
Null,
|
Null,
|
||||||
Some(*const T),
|
Some(*const T),
|
||||||
}
|
}
|
||||||
|
#[allow(unused)]
|
||||||
impl<T: Sized> OptionalPtr<T> {
|
impl<T: Sized> OptionalPtr<T> {
|
||||||
const fn with(self, value: *const T) -> Self {
|
const fn with(self, value: *const T) -> Self {
|
||||||
Self::Some(value)
|
Self::Some(value)
|
||||||
|
@ -84,7 +86,7 @@ macro_rules! plugin_define(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$crate::paste::item! {
|
$crate::pastey::item! {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
#[allow(clippy::missing_safety_doc)]
|
#[allow(clippy::missing_safety_doc)]
|
||||||
pub unsafe extern "C" fn [<gst_plugin_ $name _register>] () {
|
pub unsafe extern "C" fn [<gst_plugin_ $name _register>] () {
|
||||||
|
@ -129,3 +131,27 @@ macro_rules! plugin_define(
|
||||||
pub use self::plugin_desc::plugin_register_static;
|
pub use self::plugin_desc::plugin_register_static;
|
||||||
};
|
};
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
fn plugin_init(_plugin: &crate::Plugin) -> Result<(), glib::BoolError> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
crate::plugin_define!(
|
||||||
|
gst_rs_plugin_test,
|
||||||
|
env!("CARGO_PKG_DESCRIPTION"),
|
||||||
|
plugin_init,
|
||||||
|
env!("CARGO_PKG_VERSION"),
|
||||||
|
"MIT/X11",
|
||||||
|
env!("CARGO_PKG_NAME"),
|
||||||
|
env!("CARGO_PKG_NAME"),
|
||||||
|
env!("CARGO_PKG_REPOSITORY")
|
||||||
|
);
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn plugin_register() {
|
||||||
|
crate::init().unwrap();
|
||||||
|
plugin_register_static().unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue