fix dioxus web
This commit is contained in:
1 parent
d28221bdc2
commit
205a005142
3 files changed
+7
-14
No files matched your search
@@ -473,7 +473,7 @@ impl<T: Copy, S: Storage<SignalData<T>> + 'static> Deref for Signal<T, S> {
|
|||||||
// First we create a closure that captures something with the Same in memory layout as Self (MaybeUninit<Self>).
|
// First we create a closure that captures something with the Same in memory layout as Self (MaybeUninit<Self>).
|
||||||
let uninit_callable = MaybeUninit::<Self>::uninit();
|
let uninit_callable = MaybeUninit::<Self>::uninit();
|
||||||
// Then move that value into the closure. We assume that the closure now has a in memory layout of Self.
|
// Then move that value into the closure. We assume that the closure now has a in memory layout of Self.
|
||||||
let uninit_closure = move || Self::read(unsafe { &*uninit_callable.as_ptr() }).clone();
|
let uninit_closure = move || *Self::read(unsafe { &*uninit_callable.as_ptr() });
|
||||||
|
|
||||||
// Check that the size of the closure is the same as the size of Self in case the compiler changed the layout of the closure.
|
// Check that the size of the closure is the same as the size of Self in case the compiler changed the layout of the closure.
|
||||||
let size_of_closure = std::mem::size_of_val(&uninit_closure);
|
let size_of_closure = std::mem::size_of_val(&uninit_closure);
|
||||||
@@ -510,7 +510,7 @@ impl<T: 'static, S: Storage<SignalData<T>>> Drop for SignalSubscriberDrop<T, S>
|
|||||||
/// A mutable reference to a signal's value.
|
/// A mutable reference to a signal's value.
|
||||||
///
|
///
|
||||||
/// T is the current type of the write
|
/// T is the current type of the write
|
||||||
/// B is the dynamicly checked type of the write (RefMut)
|
/// B is the dynamically checked type of the write (RefMut)
|
||||||
/// S is the storage type of the signal
|
/// S is the storage type of the signal
|
||||||
/// I is the type of the original signal
|
/// I is the type of the original signal
|
||||||
pub struct Write<T: 'static, B: MappableMut<T>, S: Storage<SignalData<I>>, I: 'static = T> {
|
pub struct Write<T: 'static, B: MappableMut<T>, S: Storage<SignalData<I>>, I: 'static = T> {
|
||||||
@@ -640,7 +640,7 @@ impl<T: Copy, S: Storage<SignalData<T>> + 'static> Deref for ReadOnlySignal<T, S
|
|||||||
// First we create a closure that captures something with the Same in memory layout as Self (MaybeUninit<Self>).
|
// First we create a closure that captures something with the Same in memory layout as Self (MaybeUninit<Self>).
|
||||||
let uninit_callable = MaybeUninit::<Self>::uninit();
|
let uninit_callable = MaybeUninit::<Self>::uninit();
|
||||||
// Then move that value into the closure. We assume that the closure now has a in memory layout of Self.
|
// Then move that value into the closure. We assume that the closure now has a in memory layout of Self.
|
||||||
let uninit_closure = move || Self::read(unsafe { &*uninit_callable.as_ptr() }).clone();
|
let uninit_closure = move || *Self::read(unsafe { &*uninit_callable.as_ptr() });
|
||||||
|
|
||||||
// Check that the size of the closure is the same as the size of Self in case the compiler changed the layout of the closure.
|
// Check that the size of the closure is the same as the size of Self in case the compiler changed the layout of the closure.
|
||||||
let size_of_closure = std::mem::size_of_val(&uninit_closure);
|
let size_of_closure = std::mem::size_of_val(&uninit_closure);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ use std::rc::Rc;
|
|||||||
pub use crate::cfg::Config;
|
pub use crate::cfg::Config;
|
||||||
#[cfg(feature = "file_engine")]
|
#[cfg(feature = "file_engine")]
|
||||||
pub use crate::file_engine::WebFileEngineExt;
|
pub use crate::file_engine::WebFileEngineExt;
|
||||||
use dioxus_core::{ComponentFunction, CrossPlatformConfig, VirtualDom};
|
use dioxus_core::CrossPlatformConfig;
|
||||||
use futures_util::{
|
use futures_util::{
|
||||||
future::{select, Either},
|
future::{select, Either},
|
||||||
pin_mut, FutureExt, StreamExt,
|
pin_mut, FutureExt, StreamExt,
|
||||||
@@ -99,12 +99,8 @@ mod rehydrate;
|
|||||||
/// wasm_bindgen_futures::spawn_local(app_fut);
|
/// wasm_bindgen_futures::spawn_local(app_fut);
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub async fn run_with_props<
|
pub async fn run_with_props<Props: Clone + 'static>(
|
||||||
Component: ComponentFunction<Phantom, Props = Props>,
|
dioxus_config: CrossPlatformConfig<Props>,
|
||||||
Props: Clone + 'static,
|
|
||||||
Phantom: 'static,
|
|
||||||
>(
|
|
||||||
dioxus_config: CrossPlatformConfig<Component, Props, Phantom>,
|
|
||||||
web_config: Config,
|
web_config: Config,
|
||||||
) {
|
) {
|
||||||
tracing::info!("Starting up");
|
tracing::info!("Starting up");
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ pub struct WebPlatform;
|
|||||||
impl<Props: Clone + 'static> PlatformBuilder<Props> for WebPlatform {
|
impl<Props: Clone + 'static> PlatformBuilder<Props> for WebPlatform {
|
||||||
type Config = Config;
|
type Config = Config;
|
||||||
|
|
||||||
fn launch<Component: ComponentFunction<Phantom, Props = Props>, Phantom: 'static>(
|
fn launch(config: CrossPlatformConfig<Props>, platform_config: Self::Config) {
|
||||||
config: CrossPlatformConfig<Component, Props, Phantom>,
|
|
||||||
platform_config: Self::Config,
|
|
||||||
) {
|
|
||||||
wasm_bindgen_futures::spawn_local(async move {
|
wasm_bindgen_futures::spawn_local(async move {
|
||||||
crate::run_with_props(config, platform_config).await;
|
crate::run_with_props(config, platform_config).await;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user