@@ -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
@@ -604,6 +617,12 @@ impl RegionDomain {
604617 self . fill . clear ( ) ;
605618 }
606619
620+ pub fn reserve ( & mut self , additional : usize ) {
621+ self . id . reserve ( additional) ;
622+ self . segment_range . reserve ( additional) ;
623+ self . fill . reserve ( additional) ;
624+ }
625+
607626 pub fn retain ( & mut self , f : impl Fn ( & RegionId ) -> bool ) {
608627 let mut keep = self . id . iter ( ) . map ( & f) ;
609628 self . segment_range . retain ( |_| keep. next ( ) . unwrap_or_default ( ) ) ;
0 commit comments