MenuVTable

Struct MenuVTable 

Source
#[repr(C)]
pub struct MenuVTable { pub sub_menu: unsafe fn(VRef<'_, MenuVTable>, Option<&MenuEntry>, &mut SharedVector<MenuEntry>), pub activate: unsafe fn(VRef<'_, MenuVTable>, &MenuEntry), pub drop_in_place: unsafe fn(VRefMut<'_, MenuVTable>) -> Layout, pub dealloc: unsafe fn(_: &MenuVTable, ptr: *mut u8, layout: Layout), }
Expand description

Interface for native menu and menubar

Fields§

§sub_menu: unsafe fn(VRef<'_, MenuVTable>, Option<&MenuEntry>, &mut SharedVector<MenuEntry>)

Return the list of items for the sub menu (or the main menu of parent is None)

§activate: unsafe fn(VRef<'_, MenuVTable>, &MenuEntry)

Handler when the menu entry is activated

§drop_in_place: unsafe fn(VRefMut<'_, MenuVTable>) -> Layout

drop_in_place handler

§dealloc: unsafe fn(_: &MenuVTable, ptr: *mut u8, layout: Layout)

dealloc handler

Implementations§

Source§

impl MenuVTable

Source

pub fn new<T: Menu>() -> Self

Create a vtable suitable for a given type implementing the trait.

Trait Implementations§

Source§

impl HasStaticVTable<MenuVTable> for MenuFromItemTree

Source§

fn static_vtable() -> &'static MenuVTable

Safety: must be a valid VTable for Self
Source§

impl VTableMeta for MenuVTable

Source§

type VTable = MenuVTable

That’s the VTable itself (so most likely Self)
Source§

type Target = MenuTO

That’s the trait object that implements the functions Read more
Source§

impl VTableMetaDropInPlace for MenuVTable

Source§

unsafe fn drop_in_place(vtable: &Self::VTable, ptr: *mut u8) -> Layout

Safety Read more
Source§

unsafe fn dealloc(vtable: &Self::VTable, ptr: *mut u8, layout: Layout)

Safety Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.