Why can't Send and Sync be autoderived on thinsg that contain an ObjectSubclass?
I am trying to use gstreamer-rs to write my own plugin. Following the examples, I notice that plugins typically manually derive Send and Sync, e.g.:
glib::wrapper! {
pub struct Factory(ObjectSubclass<imp::Factory>) @extends gst_rtsp_server::RTSPMediaFactory;
}
// Factories must be Send+Sync, and ours is
unsafe impl Send for Factory {}
unsafe impl Sync for Factory {}
Why can't Factory
auto derive Send
and Sync
? It doesn't contain any raw pointers, Rc
's, or UnsafeCell
's which would make autoderivation impossible. From gstreamer-rs/examples/src/bin/rstp-server-subclass.rs
:
// This is the private data of our factory
#[derive(Default)]
pub struct Factory {}