From b0a922bc99c673174f3f8f155e561c7e65f8e114 Mon Sep 17 00:00:00 2001 From: Michael van Straten Date: Fri, 21 Jun 2024 16:33:31 +0200 Subject: [PATCH 1/2] Allow passing an iterable to `splice_children` --- src/api.rs | 8 ++++++-- src/cursor.rs | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/api.rs b/src/api.rs index 03b2cc2..c1d6698 100644 --- a/src/api.rs +++ b/src/api.rs @@ -256,8 +256,12 @@ impl SyntaxNode { self.raw.detach() } - pub fn splice_children(&self, to_delete: Range, to_insert: Vec>) { - let to_insert = to_insert.into_iter().map(cursor::SyntaxElement::from).collect::>(); + pub fn splice_children>>( + &self, + to_delete: Range, + to_insert: I, + ) { + let to_insert = to_insert.into_iter().map(cursor::SyntaxElement::from); self.raw.splice_children(to_delete, to_insert) } } diff --git a/src/cursor.rs b/src/cursor.rs index 3b84958..0fa2eb5 100644 --- a/src/cursor.rs +++ b/src/cursor.rs @@ -806,7 +806,11 @@ impl SyntaxNode { }) } - pub fn splice_children(&self, to_delete: Range, to_insert: Vec) { + pub fn splice_children>( + &self, + to_delete: Range, + to_insert: I, + ) { assert!(self.data().mutable, "immutable tree: {}", self); for (i, child) in self.children_with_tokens().enumerate() { if to_delete.contains(&i) { From dc1eb13afcad213632fe5f43dc636bc83a34f43a Mon Sep 17 00:00:00 2001 From: Michael van Straten Date: Sun, 18 Aug 2024 19:30:58 +0200 Subject: [PATCH 2/2] Bump crate version number --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fcee965..34c84bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rowan" -version = "0.15.16" +version = "0.16.0" authors = ["Aleksey Kladov "] repository = "https://github.com/rust-analyzer/rowan" license = "MIT OR Apache-2.0"