From 5eb346f77dac05b0a679219f2f0efbca8b017fdb Mon Sep 17 00:00:00 2001 From: Sebastian K Date: Wed, 24 Jun 2020 17:40:51 -0700 Subject: [PATCH] Add an `Outline::with_capacity()` method --- content/src/outline.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content/src/outline.rs b/content/src/outline.rs index e2b26d22..e91a0af5 100644 --- a/content/src/outline.rs +++ b/content/src/outline.rs @@ -61,6 +61,15 @@ impl Outline { } } + /// Returns a new `Outline` with storage for `capacity` contours preallocated. + #[inline] + pub fn with_capacity(capacity: usize) -> Outline { + Outline { + contours: Vec::with_capacity(capacity), + bounds: RectF::default(), + } + } + #[inline] pub fn from_segments(segments: I) -> Outline where