Untangle and move around setup structs

This commit is contained in:
Adrian Heine 2023-03-07 18:32:04 +01:00
parent 877af00806
commit ac1c06dd31
7 changed files with 594 additions and 613 deletions

View file

@ -228,7 +228,7 @@ impl<D> Resource for Cron<D> {
use std::rc::{Rc, Weak};
pub trait FromResource<R> {
fn from_resource(from: R) -> (Self, Weak<R>)
fn from_resource(from: &Rc<R>) -> (Self, Weak<R>)
where
Self: Sized;
}
@ -250,8 +250,7 @@ macro_rules! default_resources {
}
$(impl<'a, D> FromResource<$type> for DefaultResources<'a, D> {
fn from_resource(from: $type) -> (Self, Weak<$type>) {
let inner = Rc::new(from);
fn from_resource(inner: &Rc<$type>) -> (Self, Weak<$type>) {
(Self::$name(Rc::clone(&inner)), Rc::downgrade(&inner))
}
})*