PadProbeId does not implement Copy+Clone
I'm trying to log the probe id inside a PadProbe. However I can't move it out of info
except with a hack like this (info.id
is Option<PadProbeId>
). Even into_glib
would move out of the shared reference.
move |_pad, info| {
let hack: *const u64 = unsafe {transmute(info.id.as_ref())};
let clone = unsafe { *hack };
}
The implementation of Pad
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PadProbeId(NonZeroU64);
impl IntoGlib for PadProbeId {
type GlibType = libc::c_ulong;
fn into_glib(self) -> libc::c_ulong {
self.0.get() as libc::c_ulong
}
}
I think PadProbeId should derive Clone+Copy
Edited by Stephan Seitz