atom.rs 618 B

1234567891011121314151617181920212223242526
  1. use crate::{AtomValue, Readable, RecoilItem};
  2. pub type Atom<T: PartialEq> = fn(&mut AtomBuilder<T>) -> T;
  3. impl<T: AtomValue + 'static> Readable<T> for Atom<T> {
  4. fn load(&'static self) -> RecoilItem {
  5. todo!()
  6. // RecoilItem::Atom(self as *const _ as _)
  7. }
  8. }
  9. pub struct AtomBuilder<T: PartialEq> {
  10. pub key: String,
  11. _never: std::marker::PhantomData<T>,
  12. }
  13. impl<T: PartialEq> AtomBuilder<T> {
  14. pub fn new() -> Self {
  15. Self {
  16. key: "".to_string(),
  17. _never: std::marker::PhantomData {},
  18. }
  19. }
  20. pub fn set_key(&mut self, _key: &'static str) {}
  21. }