diff --git a/.gitignore b/.gitignore index 292091468..061d7111b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,7 @@ Cargo.lock # Editor-specific folders and files /.vscode -sourcemap.json \ No newline at end of file +sourcemap.json + +# macOS Finder files +.DS_Store diff --git a/rbx_dom_weak/CHANGELOG.md b/rbx_dom_weak/CHANGELOG.md index dca7fac1f..140026901 100644 --- a/rbx_dom_weak/CHANGELOG.md +++ b/rbx_dom_weak/CHANGELOG.md @@ -1,6 +1,7 @@ # rbx_dom_weak Changelog ## Unreleased Changes +* Added `InstanceBuilder::with_referent` that allows building instance with predefined `Ref` ## 2.7.0 (2024-01-16) * Implemented `Default` for `WeakDom`, useful when using Serde or creating an empty `WeakDom` diff --git a/rbx_dom_weak/src/instance.rs b/rbx_dom_weak/src/instance.rs index c576717b0..7871c3c85 100644 --- a/rbx_dom_weak/src/instance.rs +++ b/rbx_dom_weak/src/instance.rs @@ -72,6 +72,14 @@ impl InstanceBuilder { self.referent } + /// Change the referent of the `InstanceBuilder`. + pub fn with_referent>(self, referent: R) -> Self { + Self { + referent: referent.into(), + ..self + } + } + /// Change the name of the `InstanceBuilder`. pub fn with_name>(self, name: S) -> Self { Self {