pub struct DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props = ()> {
pub Root: Component<Props>,
/* private fields */
}Expand description
Dioxus Plugin for Bevy
Fields§
§Root: Component<Props>Root component
Implementations§
Source§impl<GlobalState, CoreCommand, UiCommand, Props> DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props>
impl<GlobalState, CoreCommand, UiCommand, Props> DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props>
Sourcepub fn new(Root: DioxusComponent<Props>) -> Self
pub fn new(Root: DioxusComponent<Props>) -> Self
Initialize DioxusPlugin with root component and channel types
use bevy::prelude::*;
use bevy_dioxus::desktop::prelude::*;
use dioxus::prelude::*;
// DioxusPlugin accepts any types as command. Pass empty tuple if channel is not necessary.
type CoreCommand = ();
type UiCommand = ();
fn main() {
App::new()
.add_plugin(DioxusPlugin::<EmptyGlobalState, CoreCommand, UiCommand>::new(Root))
.run();
}
fn Root(cx: Scope) -> Element {
cx.render(rsx! {
h1 { "Hello, World !" }
})
}Trait Implementations§
Source§impl<GlobalState, CoreCommand, UiCommand, Props> Plugin for DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props>
impl<GlobalState, CoreCommand, UiCommand, Props> Plugin for DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props>
Auto Trait Implementations§
impl<GlobalState, CoreCommand, UiCommand, Props> Freeze for DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props>
impl<GlobalState, CoreCommand, UiCommand, Props> RefUnwindSafe for DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props>
impl<GlobalState, CoreCommand, UiCommand, Props> Send for DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props>
impl<GlobalState, CoreCommand, UiCommand, Props> Sync for DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props>
impl<GlobalState, CoreCommand, UiCommand, Props> Unpin for DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props>
impl<GlobalState, CoreCommand, UiCommand, Props> UnwindSafe for DioxusPlugin<GlobalState, CoreCommand, UiCommand, Props>
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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.