@@ -104,6 +104,11 @@ impl PointDomain {
104104 self . position . clear ( ) ;
105105 }
106106
107+ pub fn reserve ( & mut self , additional : usize ) {
108+ self . id . reserve ( additional) ;
109+ self . position . reserve ( additional) ;
110+ }
111+
107112 pub fn retain ( & mut self , segment_domain : & mut SegmentDomain , f : impl Fn ( & PointId ) -> bool ) {
108113 let mut keep = self . id . iter ( ) . map ( & f) ;
109114 self . position . retain ( |_| keep. next ( ) . unwrap_or_default ( ) ) ;
@@ -236,6 +241,14 @@ impl SegmentDomain {
236241 self . stroke . clear ( ) ;
237242 }
238243
244+ pub fn reserve ( & mut self , additional : usize ) {
245+ self . id . reserve ( additional) ;
246+ self . start_point . reserve ( additional) ;
247+ self . end_point . reserve ( additional) ;
248+ self . handles . reserve ( additional) ;
249+ self . stroke . reserve ( additional) ;
250+ }
251+
239252 pub fn retain ( & mut self , f : impl Fn ( & SegmentId ) -> bool , points_length : usize ) {
240253 let additional_delete_ids = self
241254 . id
@@ -517,6 +530,12 @@ impl RegionDomain {
517530 self . fill . clear ( ) ;
518531 }
519532
533+ pub fn reserve ( & mut self , additional : usize ) {
534+ self . id . reserve ( additional) ;
535+ self . segment_range . reserve ( additional) ;
536+ self . fill . reserve ( additional) ;
537+ }
538+
520539 pub fn retain ( & mut self , f : impl Fn ( & RegionId ) -> bool ) {
521540 let mut keep = self . id . iter ( ) . map ( & f) ;
522541 self . segment_range . retain ( |_| keep. next ( ) . unwrap_or_default ( ) ) ;
0 commit comments