Compiling.
Need to see if I can do a generic implemented of IntoBoxedContextElement for all objects implementing Copy, and I need to implement the compare code to make sure this all works before I start integrating this more.
This commit is contained in:
@@ -55,22 +55,12 @@ impl NewParametersContext {
|
||||
.iter()
|
||||
.map(|kvpair| (kvpair.key.to_string(), OwnedRValue::from(&kvpair.value)))
|
||||
.collect();
|
||||
|
||||
let x: String = "foo".to_owned();
|
||||
let y: &dyn ContextElement = &x as _;
|
||||
let z: Box<dyn ContextElement> = y.clone().to_box();
|
||||
// let owned_y: Box<dyn ContextElement> = Box::new(*y.clone());
|
||||
// unsafe {
|
||||
// let ce = &mut *y.clone() as *mut dyn ContextElement;
|
||||
// Box::from_raw(ce);
|
||||
// }
|
||||
|
||||
// let owned_breadcrumbs: Vec<Box<dyn ContextElement>> =
|
||||
// breadcrumbs.iter().map(|ce| Box::new(*ce.clone())).collect();
|
||||
let owned_breadcrumbs: Vec<Box<dyn ContextElement>> =
|
||||
breadcrumbs.iter().map(|ce| ce.clone_to_box()).collect();
|
||||
|
||||
NewParametersContext {
|
||||
params: owned_params,
|
||||
breadcrumbs: Vec::new(),
|
||||
breadcrumbs: owned_breadcrumbs,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,3 +140,9 @@ impl Walkable for String {
|
||||
Err(WalkError::CantWalk)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoBoxedContextElement for String {
|
||||
fn clone_to_box(&self) -> Box<dyn ContextElement> {
|
||||
Box::new(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user