From 0bb9b388f790e53f915f446d938337ff2717e331 Mon Sep 17 00:00:00 2001 From: Paul Horn Date: Thu, 21 May 2020 20:15:43 +0200 Subject: [PATCH] Borrow layout for splitting instead of moving it This allows for layouts to be saved and reused and does not require an additional clone --- src/layout.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layout.rs b/src/layout.rs index 0224538..5410a72 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -174,12 +174,12 @@ impl Layout { /// ] /// ); /// ``` - pub fn split(self, area: Rect) -> Vec { + pub fn split(&self, area: Rect) -> Vec { // TODO: Maybe use a fixed size cache ? LAYOUT_CACHE.with(|c| { c.borrow_mut() .entry((area, self.clone())) - .or_insert_with(|| split(area, &self)) + .or_insert_with(|| split(area, self)) .clone() }) }