#[derive(CloneTypeIntoContext)]Expand description
Implement CloneTypeIntoContext
for a Type by delegating to its own
CloneIntoContext impl,
then re-interning the clone into dst_ctx.
The type must already implement
CloneIntoContext (e.g. via
#[derive(CloneIntoContext)],
or impl_clone_into_context_for_clone!).
Usage:
use pliron::{
context::Context,
derive::{CloneIntoContext, CloneTypeIntoContext, pliron_type},
irbuild::decontext::CloneIntoContext as _, printable::Printable,
};
#[pliron_type(
name = "test.point_type",
format = "`<` $x `>`",
generate_get = true,
verifier = "succ"
)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, CloneIntoContext, CloneTypeIntoContext)]
struct PointType {
x: i32,
}
let src_ctx = Context::new();
let mut dst_ctx = Context::new();
let p = PointType::get(&src_ctx, 1).to_handle();
let p2 = p.clone_into_context(&src_ctx, &mut dst_ctx);
assert_eq!(p.disp(&src_ctx).to_string(), p2.disp(&dst_ctx).to_string());