Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::fmt::Debug;
- use std::cell::RefCell;
- use std::rc::Rc;
- use std::any::Any;
- pub trait ScalarType: Debug {}
- pub trait AttributeType: Debug {}
- impl<T> AttributeType for T where T: ScalarType {}
- impl<T> AttributeType for (T, T) where T: ScalarType {}
- #[derive(Debug)]
- pub struct Attribute<T> where T: AttributeType + 'static {
- value: RefCell<T>,
- name: String,
- }
- trait Attributing: Debug {
- type Inner;
- fn get_value(&self) -> &Self::Inner;
- fn set_value(&mut self, value: Self::Inner);
- fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any>;
- }
- impl<T> Attributing for Attribute<T> where T: AttributeType {
- type Inner = T;
- fn get_value(&self) -> &T {
- unimplemented!()
- }
- fn set_value(&mut self, value: T) {
- unimplemented!()
- }
- fn into_any_rc(self: Rc<Self>) -> Rc<dyn Any> {
- self
- }
- }
- fn main() { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement