Skip to content

Commit

Permalink
Fixed rooted_vec! Macro with Iterator Initialisation (#549)
Browse files Browse the repository at this point in the history
Signed-off-by: Redfire <redfire75369@hotmail.com>
  • Loading branch information
Redfire75369 authored Jan 24, 2025
1 parent faeeb8f commit f5ed6f9
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions mozjs/src/gc/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,13 @@ macro_rules! rooted_vec {
let mut __root = $crate::gc::RootableVec::new_unrooted();
let mut $name = $crate::gc::RootedVec::new(&mut __root);
};
(let mut $name:ident: $type:ty) => {
(let $name:ident <- $iter:expr) => {
let mut __root = $crate::gc::RootableVec::new_unrooted();
let mut $name: $crate::gc::RootedVec<$type> = $crate::gc::RootedVec::new(&mut __root);
let $name = $crate::gc::RootedVec::from_iter(&mut __root, $iter);
};
(let mut $name:ident = $init:expr) => {
(let mut $name:ident <- $iter:expr) => {
let mut __root = $crate::gc::RootableVec::new_unrooted();
let mut $name = $crate::gc::RootedVec::new(&mut __root);
::std::iter::Extend::extend(&mut $name, $init);
};
(let mut $name:ident: $type:ty = $init:expr) => {
let mut __root = $crate::gc::RootableVec::new_unrooted();
let mut $name: $crate::gc::RootedVec<$type> = $crate::gc::RootedVec::new(&mut __root);
::std::iter::Extend::extend(&mut $name, $init);
let mut $name = $crate::gc::RootedVec::from_iter(&mut __root, $iter);
};
}

Expand Down

0 comments on commit f5ed6f9

Please sign in to comment.