#[repr(C)]pub struct Callback {
pub cb: CallbackType,
pub ctx: OptionRefAny,
}Expand description
Stores a function pointer that is executed when the given UI element is hit
Must return an Update that denotes if the screen should be redrawn.
Fields§
§cb: CallbackType§ctx: OptionRefAnyFor FFI: stores the foreign callable (e.g., PyFunction) Native Rust code sets this to None
Implementations§
Source§impl Callback
impl Callback
Sourcepub fn create<C: Into<Callback>>(cb: C) -> Self
pub fn create<C: Into<Callback>>(cb: C) -> Self
Create a new callback with just a function pointer (for native Rust code)
Sourcepub fn from_core(core: CoreCallback) -> Self
pub fn from_core(core: CoreCallback) -> Self
Convert from CoreCallback (stored as usize) to Callback (actual function pointer)
§Safety
The caller must ensure that the usize in CoreCallback.cb was originally a valid
function pointer of type CallbackType. This is guaranteed when CoreCallback
is created through standard APIs, but unsafe code could violate this.
Sourcepub fn to_core(self) -> CoreCallback
pub fn to_core(self) -> CoreCallback
Convert to CoreCallback (function pointer stored as usize)
This is always safe - we’re just casting the function pointer to usize for storage.
Trait Implementations§
Source§impl From<Callback> for ButtonOnClickCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for ButtonOnClickCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> ButtonOnClickCallback
fn from(cb: Callback) -> ButtonOnClickCallback
Source§impl From<Callback> for CheckBoxOnToggleCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for CheckBoxOnToggleCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> CheckBoxOnToggleCallback
fn from(cb: Callback) -> CheckBoxOnToggleCallback
Source§impl From<Callback> for ColorInputOnValueChangeCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for ColorInputOnValueChangeCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> ColorInputOnValueChangeCallback
fn from(cb: Callback) -> ColorInputOnValueChangeCallback
Source§impl From<Callback> for CoreCallback
Allow Callback to be passed to functions expecting C: Into<CoreCallback>
impl From<Callback> for CoreCallback
Allow Callback to be passed to functions expecting C: Into<CoreCallback>
Source§impl From<Callback> for DropDownOnChoiceChangeCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for DropDownOnChoiceChangeCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> DropDownOnChoiceChangeCallback
fn from(cb: Callback) -> DropDownOnChoiceChangeCallback
Source§impl From<Callback> for FileInputOnPathChangeCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for FileInputOnPathChangeCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> FileInputOnPathChangeCallback
fn from(cb: Callback) -> FileInputOnPathChangeCallback
Source§impl From<Callback> for ListViewOnColumnClickCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for ListViewOnColumnClickCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> ListViewOnColumnClickCallback
fn from(cb: Callback) -> ListViewOnColumnClickCallback
Source§impl From<Callback> for ListViewOnLazyLoadScrollCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for ListViewOnLazyLoadScrollCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> ListViewOnLazyLoadScrollCallback
fn from(cb: Callback) -> ListViewOnLazyLoadScrollCallback
Source§impl From<Callback> for ListViewOnRowClickCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for ListViewOnRowClickCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> ListViewOnRowClickCallback
fn from(cb: Callback) -> ListViewOnRowClickCallback
Source§impl From<Callback> for NumberInputOnFocusLostCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for NumberInputOnFocusLostCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> NumberInputOnFocusLostCallback
fn from(cb: Callback) -> NumberInputOnFocusLostCallback
Source§impl From<Callback> for NumberInputOnValueChangeCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for NumberInputOnValueChangeCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> NumberInputOnValueChangeCallback
fn from(cb: Callback) -> NumberInputOnValueChangeCallback
Source§impl From<Callback> for OnNodeAddedCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for OnNodeAddedCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> OnNodeAddedCallback
fn from(cb: Callback) -> OnNodeAddedCallback
Source§impl From<Callback> for OnNodeConnectedCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for OnNodeConnectedCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> OnNodeConnectedCallback
fn from(cb: Callback) -> OnNodeConnectedCallback
Source§impl From<Callback> for OnNodeDraggedCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for OnNodeDraggedCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> OnNodeDraggedCallback
fn from(cb: Callback) -> OnNodeDraggedCallback
Source§impl From<Callback> for OnNodeFieldEditedCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for OnNodeFieldEditedCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> OnNodeFieldEditedCallback
fn from(cb: Callback) -> OnNodeFieldEditedCallback
Source§impl From<Callback> for OnNodeGraphDraggedCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for OnNodeGraphDraggedCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> OnNodeGraphDraggedCallback
fn from(cb: Callback) -> OnNodeGraphDraggedCallback
Source§impl From<Callback> for OnNodeInputDisconnectedCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for OnNodeInputDisconnectedCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> OnNodeInputDisconnectedCallback
fn from(cb: Callback) -> OnNodeInputDisconnectedCallback
Source§impl From<Callback> for OnNodeOutputDisconnectedCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for OnNodeOutputDisconnectedCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> OnNodeOutputDisconnectedCallback
fn from(cb: Callback) -> OnNodeOutputDisconnectedCallback
Source§impl From<Callback> for OnNodeRemovedCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for OnNodeRemovedCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> OnNodeRemovedCallback
fn from(cb: Callback) -> OnNodeRemovedCallback
Source§impl From<Callback> for RibbonOnTabClickedCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for RibbonOnTabClickedCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> RibbonOnTabClickedCallback
fn from(cb: Callback) -> RibbonOnTabClickedCallback
Source§impl From<Callback> for TabOnClickCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for TabOnClickCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> TabOnClickCallback
fn from(cb: Callback) -> TabOnClickCallback
Source§impl From<Callback> for TextInputOnFocusLostCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for TextInputOnFocusLostCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> TextInputOnFocusLostCallback
fn from(cb: Callback) -> TextInputOnFocusLostCallback
Source§impl From<Callback> for TextInputOnTextInputCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for TextInputOnTextInputCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> TextInputOnTextInputCallback
fn from(cb: Callback) -> TextInputOnTextInputCallback
Source§impl From<Callback> for TextInputOnVirtualKeyDownCallback
Allow creating widget callback from a generic Callback
This enables Python/FFI code to pass generic callbacks to widget methods
impl From<Callback> for TextInputOnVirtualKeyDownCallback
Allow creating widget callback from a generic Callback This enables Python/FFI code to pass generic callbacks to widget methods
Source§fn from(cb: Callback) -> TextInputOnVirtualKeyDownCallback
fn from(cb: Callback) -> TextInputOnVirtualKeyDownCallback
Source§impl From<extern "C" fn(RefAny, CallbackInfo) -> Update> for Callback
Allow creating callback from a raw function pointer
Sets callable to None (for native Rust/C usage)
impl From<extern "C" fn(RefAny, CallbackInfo) -> Update> for Callback
Allow creating callback from a raw function pointer Sets callable to None (for native Rust/C usage)
Source§fn from(cb: CallbackType) -> Self
fn from(cb: CallbackType) -> Self
Source§impl Ord for Callback
impl Ord for Callback
Source§impl PartialOrd for Callback
impl PartialOrd for Callback
impl Eq for Callback
Auto Trait Implementations§
impl Freeze for Callback
impl RefUnwindSafe for Callback
impl Send for Callback
impl Sync for Callback
impl Unpin for Callback
impl UnwindSafe for Callback
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