#[derive(CloneAttributeIntoContext)]Expand description
Implement CloneAttributeIntoContext for an Attribute by delegating to its own CloneIntoContext impl and boxing the result.
The type must already implement
CloneIntoContext (e.g. via
#[derive(CloneIntoContext)],
or impl_clone_into_context_for_clone!).
Usage:
use pliron::{
attribute::AttrObj, context::Context,
derive::{CloneAttributeIntoContext, CloneIntoContext, pliron_attr},
irbuild::decontext::CloneIntoContext as _, printable::Printable,
};
#[pliron_attr(name = "test.point_attr", format = "`<` $x `>`", verifier = "succ")]
#[derive(Debug, Clone, PartialEq, Eq, Hash, CloneIntoContext, CloneAttributeIntoContext)]
struct PointAttr {
x: i32,
}
let src_ctx = Context::new();
let mut dst_ctx = Context::new();
let a: AttrObj = Box::new(PointAttr { x: 1 });
let a2 = a.clone_into_context(&src_ctx, &mut dst_ctx);
assert_eq!(a.disp(&src_ctx).to_string(), a2.disp(&dst_ctx).to_string());