#[repr(C)]pub struct RenderImageCallback {
pub cb: RenderImageCallbackType,
pub ctx: OptionRefAny,
}Expand description
Callback that returns a rendered OpenGL texture
IMPORTANT: In azul-core, this is stored as CoreRenderImageCallback with
a cb: usize field. When creating callbacks in the data model, function pointers
are cast to usize. This type is used in azul-layout where we can safely work
with the actual function pointer type.
Fields§
§cb: RenderImageCallbackType§ctx: OptionRefAnyFor FFI: stores the foreign callable (e.g., PyFunction) Native Rust code sets this to None
Implementations§
Source§impl RenderImageCallback
impl RenderImageCallback
Sourcepub fn create(cb: RenderImageCallbackType) -> Self
pub fn create(cb: RenderImageCallbackType) -> Self
Create a new callback with just a function pointer (for native Rust code)
Sourcepub fn from_core(core_callback: &CoreRenderImageCallback) -> Self
pub fn from_core(core_callback: &CoreRenderImageCallback) -> Self
Convert from the core crate’s CoreRenderImageCallback (which stores cb as usize)
back to the layout crate’s typed function pointer.
§Safety
This is safe because we ensure that the usize in CoreRenderImageCallback was originally created from a valid RenderImageCallbackType function pointer.
Sourcepub fn to_core(self) -> CoreRenderImageCallback
pub fn to_core(self) -> CoreRenderImageCallback
Convert to CoreRenderImageCallback (function pointer stored as usize)
This is always safe - we’re just casting the function pointer to usize for storage.
Trait Implementations§
Source§impl Clone for RenderImageCallback
impl Clone for RenderImageCallback
Source§impl Debug for RenderImageCallback
impl Debug for RenderImageCallback
Source§impl Display for RenderImageCallback
impl Display for RenderImageCallback
Source§impl From<RenderImageCallback> for CoreRenderImageCallback
Allow RenderImageCallback to be passed to functions expecting C: Into<CoreRenderImageCallback>
impl From<RenderImageCallback> for CoreRenderImageCallback
Allow RenderImageCallback to be passed to functions expecting C: Into<CoreRenderImageCallback>
Source§fn from(callback: RenderImageCallback) -> Self
fn from(callback: RenderImageCallback) -> Self
Source§impl From<extern "C" fn(RefAny, RenderImageCallbackInfo) -> ImageRef> for RenderImageCallback
Allow creating callback from a raw function pointer
Sets callable to None (for native Rust/C usage)
impl From<extern "C" fn(RefAny, RenderImageCallbackInfo) -> ImageRef> for RenderImageCallback
Allow creating callback from a raw function pointer Sets callable to None (for native Rust/C usage)
Source§fn from(cb: RenderImageCallbackType) -> Self
fn from(cb: RenderImageCallbackType) -> Self
Source§impl Hash for RenderImageCallback
impl Hash for RenderImageCallback
Source§impl Ord for RenderImageCallback
impl Ord for RenderImageCallback
Source§impl PartialEq for RenderImageCallback
impl PartialEq for RenderImageCallback
Source§impl PartialOrd for RenderImageCallback
impl PartialOrd for RenderImageCallback
impl Eq for RenderImageCallback
Auto Trait Implementations§
impl Freeze for RenderImageCallback
impl RefUnwindSafe for RenderImageCallback
impl Send for RenderImageCallback
impl Sync for RenderImageCallback
impl Unpin for RenderImageCallback
impl UnwindSafe for RenderImageCallback
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more