1use crate::mem::manager::Manager;
2
3use super::{
4 any::Any,
5 any_cast::AnyCast,
6 js_array::new_array,
7 js_object::new_object,
8 js_string::{new_string, JsStringRef},
9};
10
11pub trait New: Manager {
12 fn new_js_array(
13 self,
14 i: impl IntoIterator<IntoIter = impl ExactSizeIterator<Item = Any<Self::Dealloc>>>,
15 ) -> Any<Self::Dealloc> {
16 new_array(self, i).to_ref().move_to_any()
17 }
18 fn new_js_string(
19 self,
20 s: impl IntoIterator<IntoIter = impl ExactSizeIterator<Item = u16>>,
21 ) -> Any<Self::Dealloc> {
22 new_string(self, s).to_ref().move_to_any()
23 }
24 fn new_js_object(
25 self,
26 i: impl IntoIterator<
27 IntoIter = impl ExactSizeIterator<Item = (JsStringRef<Self::Dealloc>, Any<Self::Dealloc>)>,
28 >,
29 ) -> Any<Self::Dealloc> {
30 new_object(self, i).to_ref().move_to_any()
31 }
32}
33
34impl<M: Manager> New for M {}