#![cfg(feature = "macros")] use rhizome::extractable; use std::any::TypeId; extractable! { /// Extractable attributes. pub trait Extractable: Debug for final } #[test] fn test_extractable() { use rhizome::{extensions::*, Node}; enum Owner {} #[derive(Debug)] struct Fake; impl Extractable for Fake {} let root = Node::new_for::().into_arc(); let mut branch = root.derive_for::(); assert_eq!( Extractable::extract_from(&branch).unwrap().type_id(), TypeId::of::() ); assert_eq!( Extractable::extract_from(&root).unwrap().type_id(), TypeId::of::() ); Extractable::provide_custom(&mut branch, Fake {}).unwrap(); assert_eq!( Extractable::extract_from(&branch).unwrap().type_id(), TypeId::of::() ); assert_eq!( Extractable::extract_from(&root).unwrap().type_id(), TypeId::of::() ); }