i_slint_core

Macro OpaqueImageVTable_static

Source
macro_rules! OpaqueImageVTable_static {
    ($(#[$meta:meta])* $vis:vis static $ident:ident for $ty:ty) => { ... };
}
Expand description

Instantiate a static OpaqueImageVTable for a given type and implements vtable::HasStaticVTable<OpaqueImageVTable> for it.

// The preview above is misleading because of rust-lang/rust#45939, so it is reproduced below
macro_rules! OpaqueImageVTable_static {
    ($(#[$meta:meta])* $vis:vis static $ident:ident for $ty:ty) => { ... }
}

Given a type MyType that implements the trait OpaqueImage , create a static variable of type OpaqueImageVTable, and implements HasStaticVTable for it.

    struct Foo { ... }
    impl OpaqueImage for Foo { ... }
    OpaqueImageVTable_static!(static FOO_VTABLE for Foo);
    // now VBox::new can be called
    let vbox = VBox::new(Foo{ ... });

Note: Was generated from the #[vtable] macro on OpaqueImageVTable