From ee83b9e7c596b2e9482658c2e83f00d4ecd3597f Mon Sep 17 00:00:00 2001 From: Kenneth Loeffler Date: Fri, 22 Sep 2023 13:07:00 -0700 Subject: [PATCH] Add docs --- rbx_dom_weak/src/dom.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rbx_dom_weak/src/dom.rs b/rbx_dom_weak/src/dom.rs index f1a5d093d..464b9f6f1 100644 --- a/rbx_dom_weak/src/dom.rs +++ b/rbx_dom_weak/src/dom.rs @@ -264,6 +264,10 @@ impl WeakDom { /// Any Ref properties that point to instances contained in the subtree are /// rewritten to point to the cloned instances. Any other Ref properties /// would be invalid in `dest` and are thus rewritten to be `Ref::none()` + /// + /// This means that if you call this method on multiple different instances, Ref + /// properties will not necessarily be preserved in the destination dom. If you're + /// cloning multiple instances, prefer `clone_multiple_into_external` instead! pub fn clone_into_external(&self, referent: Ref, dest: &mut WeakDom) -> Ref { let mut ctx = CloneContext::default(); let root_builder = ctx.clone_ref_as_builder(self, referent); @@ -278,7 +282,8 @@ impl WeakDom { root_ref } - /// Ok + /// Similar to clone_into_external, but clones multiple subtrees all at once. This + /// method will preserve Ref properties that point across the cloned subtrees. pub fn clone_multiple_into_external(&self, referents: &[Ref], dest: &mut WeakDom) -> Vec { let mut ctx = CloneContext::default(); let mut root_refs = Vec::with_capacity(referents.len());