pub struct LaunchBuilder { /* private fields */ }Expand description
A builder for a fullstack app.
Implementations§
Source§impl LaunchBuilder
impl LaunchBuilder
Sourcepub fn new() -> LaunchBuilder
pub fn new() -> LaunchBuilder
Create a new builder for your application. This will create a launch configuration for the current platform based on the features enabled on the dioxus crate.
Sourcepub fn web() -> LaunchBuilder
pub fn web() -> LaunchBuilder
Launch your web application.
Sourcepub fn custom(
launch_fn: fn(_: fn() -> Result<VNode, RenderError>, _: Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>, _: Vec<Box<dyn Any>>),
) -> LaunchBuilder
pub fn custom( launch_fn: fn(_: fn() -> Result<VNode, RenderError>, _: Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>, _: Vec<Box<dyn Any>>), ) -> LaunchBuilder
Provide a custom launch function for your application.
Useful for third party renderers to tap into the launch builder API without having to reimplement it.
§Example
use dioxus::prelude::*;
use std::any::Any;
#[derive(Default)]
struct Config;
fn my_custom_launcher(root: fn() -> Element, contexts: Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>, cfg: Vec<Box<dyn Any>>) {
println!("launching with root: {:?}", root());
loop {
println!("running...");
}
}
fn app() -> Element {
rsx! {
div { "Hello, world!" }
}
}
dioxus::LaunchBuilder::custom(my_custom_launcher).launch(app);Source§impl LaunchBuilder
impl LaunchBuilder
Sourcepub fn with_context_provider(
self,
state: impl Fn() -> Box<dyn Any> + Send + Sync + 'static,
) -> LaunchBuilder
pub fn with_context_provider( self, state: impl Fn() -> Box<dyn Any> + Send + Sync + 'static, ) -> LaunchBuilder
Inject state into the root component’s context that is created on the thread that the app is launched on.
Sourcepub fn with_context(
self,
state: impl Any + Clone + Send + Sync + 'static,
) -> LaunchBuilder
pub fn with_context( self, state: impl Any + Clone + Send + Sync + 'static, ) -> LaunchBuilder
Inject state into the root component’s context.
Source§impl LaunchBuilder
impl LaunchBuilder
Sourcepub fn with_cfg(self, config: impl LaunchConfig) -> LaunchBuilder
pub fn with_cfg(self, config: impl LaunchConfig) -> LaunchBuilder
Provide a platform-specific config to the builder.
Auto Trait Implementations§
impl Freeze for LaunchBuilder
impl !RefUnwindSafe for LaunchBuilder
impl !Send for LaunchBuilder
impl !Sync for LaunchBuilder
impl Unpin for LaunchBuilder
impl !UnwindSafe for LaunchBuilder
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> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.