Commenting out the parameterscontext type.

This commit is contained in:
Tom Alexander
2020-05-10 19:01:02 -04:00
parent 6fb329388f
commit 5c79b436a0
3 changed files with 65 additions and 50 deletions

View File

@@ -4,7 +4,10 @@ use crate::renderer::errors::WalkError;
use std::any::Any;
use std::fmt::Debug;
pub trait ContextElement: Debug + Walkable + Renderable + Loopable {}
pub trait ContextElement:
Debug + Walkable + Renderable + Loopable + IntoBoxedContextElement
{
}
pub trait Walkable {
fn walk(&self, segment: &str) -> Result<&dyn ContextElement, WalkError>;
@@ -31,6 +34,16 @@ pub trait CompareContextElement {
fn to_any(&self) -> &dyn Any;
}
pub trait IntoBoxedContextElement {
fn to_box(self) -> Box<dyn ContextElement>;
}
impl<C: 'static + ContextElement> IntoBoxedContextElement for C {
fn to_box(self) -> Box<dyn ContextElement> {
Box::new(self)
}
}
// impl PartialEq<dyn ContextElement> for dyn ContextElement {
// fn eq(&self, other: &dyn ContextElement) -> bool {
// todo!()