pub trait MainloopInnerType {
type I: MainloopInternalType;
// Required methods
fn get_ptr(&self) -> *mut Self::I;
fn get_api_ptr(&self) -> *const MainloopApi;
fn get_api(&self) -> &MainloopApi;
fn supports_rtclock(&self) -> bool;
// Provided method
unsafe fn new(
ptr: *mut Self::I,
api: *const MainloopApi,
dropfn: fn(&mut MainloopInner<Self::I>),
supports_rtclock: bool,
) -> MainloopInner<Self::I> { ... }
}
Expand description
This enables generic type enforcement with MainloopInner objects, and describes mandatory accessors for the internal pointers, allowing access to these pointers across the generic implementations to work.
Required Associated Types§
Sourcetype I: MainloopInternalType
type I: MainloopInternalType
Internal mainloop type.
Required Methods§
Sourcefn get_ptr(&self) -> *mut Self::I
fn get_ptr(&self) -> *mut Self::I
Return opaque main loop object pointer.
Warning: The pointer is only valid for the lifetime of this object.
Sourcefn get_api_ptr(&self) -> *const MainloopApi
fn get_api_ptr(&self) -> *const MainloopApi
Return raw API object pointer.
Warning: The pointer is only valid for the lifetime of this object.
Sourcefn get_api(&self) -> &MainloopApi
fn get_api(&self) -> &MainloopApi
Return main loop API object pointer.
Sourcefn supports_rtclock(&self) -> bool
fn supports_rtclock(&self) -> bool
Returns true
if the mainloop implementation supports monotonic based time events.
Provided Methods§
Sourceunsafe fn new(
ptr: *mut Self::I,
api: *const MainloopApi,
dropfn: fn(&mut MainloopInner<Self::I>),
supports_rtclock: bool,
) -> MainloopInner<Self::I>
unsafe fn new( ptr: *mut Self::I, api: *const MainloopApi, dropfn: fn(&mut MainloopInner<Self::I>), supports_rtclock: bool, ) -> MainloopInner<Self::I>
Create a new instance
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
Source§impl<T> MainloopInnerType for MainloopInner<T>where
T: MainloopInternalType,
This is the actual implementation of the ‘inner type’ trait.
impl<T> MainloopInnerType for MainloopInner<T>where
T: MainloopInternalType,
This is the actual implementation of the ‘inner type’ trait.
It is not possible to replace this with ‘default’ method implementations within the trait itself since the trait does not know about the existence of the struct attributes being accessed.