* clear away prelude on dioxus * clippy * wip - drop prelude from dioxus-html * docs clippy * wip * more fixe * delete all preludes * doc... * better export * merge some imports * fewer global imports * global incremental renderer * fix cargo doc
30 lines
810 B
Rust
30 lines
810 B
Rust
use crate::{ReadOnlySignal, Signal};
|
|
use dioxus_core::SuperFrom;
|
|
|
|
#[doc(hidden)]
|
|
pub struct SignalFromMarker<M>(std::marker::PhantomData<M>);
|
|
|
|
impl<T, O, M> SuperFrom<T, SignalFromMarker<M>> for ReadOnlySignal<O>
|
|
where
|
|
O: SuperFrom<T, M>,
|
|
{
|
|
fn super_from(input: T) -> Self {
|
|
ReadOnlySignal::new(Signal::new(O::super_from(input)))
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
#[allow(unused)]
|
|
fn into_signal_compiles() {
|
|
use dioxus_core::SuperInto;
|
|
fn takes_signal_string<M>(_: impl SuperInto<ReadOnlySignal<String>, M>) {}
|
|
|
|
fn takes_option_signal_string<M>(_: impl SuperInto<ReadOnlySignal<Option<String>>, M>) {}
|
|
|
|
fn don_t_run() {
|
|
takes_signal_string("hello world");
|
|
takes_signal_string(Signal::new(String::from("hello world")));
|
|
takes_option_signal_string("hello world");
|
|
}
|
|
}
|