wip: recoil

This commit is contained in:
Jonathan Kelley committed 2021-05-26 01:40:30 -04:00
1 parent 3cfa1fe125
commit ee67654f58
31 files changed
+1369 -235

No files matched your search

+106
View File
@@ -32,3 +32,109 @@ impl Properties for () {
pub fn fc_to_builder<T: Properties>(_f: FC<T>) -> T::Builder {
T::builder()
}
mod testing {
use std::any::Any;
// trait PossibleProps {
// type POut: PartialEq;
// fn as_partial_eq(&self) -> Option<&Self::POut> {
// None
// }
// }
// impl<T: PartialEq> PossibleProps for T {
// type POut = Self;
// }
// struct SomeProps2<'a> {
// inner: &'a str,
// }
// Fallback trait for to all types to default to `false`.
trait NotEq {
const IS_EQ: bool = false;
}
impl<T> NotEq for T {}
// Concrete wrapper type where `IS_COPY` becomes `true` if `T: Copy`.
struct IsEq<G, T>(std::marker::PhantomData<(G, T)>);
impl<G: PartialEq, T: PartialEq<G>> IsEq<G, T> {
// Because this is implemented directly on `IsCopy`, it has priority over
// the `NotCopy` trait impl.
//
// Note: this is a *totally different* associated constant from that in
// `NotCopy`. This does not specialize the `NotCopy` trait impl on `IsCopy`.
const IS_EQ: bool = true;
}
#[derive(PartialEq)]
struct SomeProps {
inner: &'static str,
}
struct SomeProps2 {
inner: &'static str,
}
#[test]
fn test() {
let g = IsEq::<SomeProps, SomeProps>::IS_EQ;
// let g = IsEq::<Vec<u32>>::IS_COPY;
// let g = IsEq::<u32>::IS_COPY;
// dbg!(g);
// let props = SomeProps { inner: "asd" };
// let intermediate: Box<dyn PartialEq<SomeProps>> = Box::new(props);
// let as_any: Box<dyn Any> = Box::new(intermediate);
// let as_partialeq = as_any
// .downcast_ref::<Box<dyn PartialEq<SomeProps>>>()
// .unwrap();
}
// struct blah {}
// #[reorder_args]
pub fn blah(a: i32, b: &str, c: &str) {}
// pub mod blah {
// pub const a: u8 = 0;
// pub const b: u8 = 1;
// }
trait Eat {}
impl Eat for fn() {}
impl<T> Eat for fn(T) {}
impl<T, K> Eat for fn(T, K) {}
mod other {
use super::blah;
fn test2() {
// rsx!{
// div {
// Ele {
// a: 10,
// b: "asd"
// c: impl Fn() -> ()
// }
// }
// }
// becomes
// const reorder: fn(_, _) = |a, b| {};
// blah::META;
// let a = 10;
// let b = "asd";
// let g = [10, 10.0];
// let c = g.a;
// blah(10, "asd");
}
}
}
mod style {}