diff options
author | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-06-05 16:40:53 +0530 |
---|---|---|
committer | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-06-05 16:40:53 +0530 |
commit | 8059e8b8d292fc9ab1ec54a957c0531b7106711f (patch) | |
tree | 0efdbc2c8478f64bc208c0e0fbab25422556f39e /src | |
parent | b9c485a6e4fe629014ac1ddcc56bd2a78f7b7c66 (diff) |
Revert "An attempt to make it better by removing BorrowMut... to no avail, but different error"
This reverts commit b9c485a6e4fe629014ac1ddcc56bd2a78f7b7c66.
Diffstat (limited to 'src')
-rw-r--r-- | src/interactive/react/block.rs | 4 | ||||
-rw-r--r-- | src/interactive/react/list.rs | 2 | ||||
-rw-r--r-- | src/interactive/react/terminal.rs | 15 | ||||
-rw-r--r-- | src/interactive/widgets/entries.rs | 2 | ||||
-rw-r--r-- | src/interactive/widgets/footer.rs | 2 | ||||
-rw-r--r-- | src/interactive/widgets/help.rs | 2 | ||||
-rw-r--r-- | src/interactive/widgets/main.rs | 6 |
7 files changed, 14 insertions, 19 deletions
diff --git a/src/interactive/react/block.rs b/src/interactive/react/block.rs index 15ea24e..a0fd2e2 100644 --- a/src/interactive/react/block.rs +++ b/src/interactive/react/block.rs @@ -67,7 +67,7 @@ impl<'a> BlockProps<'a> { } pub fn render(&self, area: Rect, buf: &mut Buffer) { - Block::<()>::default().render(self, &mut (), area, buf); + Block::<()>::default().render(self, (), area, buf); } } @@ -78,7 +78,7 @@ impl<'a, T> Component for Block<'a, T> { fn render( &mut self, props: impl Borrow<Self::Props>, - _: &mut Self::PropsMut, + _: impl BorrowMut<Self::PropsMut>, area: Rect, buf: &mut Buffer, ) { diff --git a/src/interactive/react/list.rs b/src/interactive/react/list.rs index 7d88502..033084f 100644 --- a/src/interactive/react/list.rs +++ b/src/interactive/react/list.rs @@ -61,7 +61,7 @@ where fn render( &mut self, props: impl Borrow<Self::Props>, - mut props_mut: &mut Self::PropsMut, + mut props_mut: impl BorrowMut<Self::PropsMut>, area: Rect, buf: &mut Buffer, ) { diff --git a/src/interactive/react/terminal.rs b/src/interactive/react/terminal.rs index 515564b..b2b38bd 100644 --- a/src/interactive/react/terminal.rs +++ b/src/interactive/react/terminal.rs @@ -12,7 +12,7 @@ pub trait Component { fn render( &mut self, props: impl Borrow<Self::Props>, - props_mut: &mut Self::PropsMut, + props_mut: impl BorrowMut<Self::PropsMut>, area: Rect, buf: &mut Buffer, ); @@ -90,7 +90,7 @@ where &mut self, component: &mut C, props: impl Borrow<C::Props>, - mut props_mut: impl BorrowMut<C::PropsMut>, + props_mut: impl BorrowMut<C::PropsMut>, ) -> io::Result<()> where C: Component, @@ -99,12 +99,7 @@ where // and the terminal (if growing), which may OOB. self.autoresize()?; - component.render( - props, - props_mut.borrow_mut(), - self.known_size, - self.current_buffer_mut(), - ); + component.render(props, props_mut, self.known_size, self.current_buffer_mut()); self.reconcile_and_flush()?; @@ -168,7 +163,7 @@ mod tests { fn render( &mut self, props: impl Borrow<Self::Props>, - _props_mut: &mut Self::PropsMut, + _props_mut: impl BorrowMut<Self::PropsMut>, _area: Rect, _buf: &mut Buffer, ) { @@ -182,7 +177,7 @@ mod tests { fn render( &mut self, props: impl Borrow<Self::Props>, - _props_mut: &mut Self::PropsMut, + _props_mut: impl BorrowMut<Self::PropsMut>, area: Rect, _buf: &mut Buffer, ) { diff --git a/src/interactive/widgets/entries.rs b/src/interactive/widgets/entries.rs index ede21ea..dc119a6 100644 --- a/src/interactive/widgets/entries.rs +++ b/src/interactive/widgets/entries.rs @@ -164,6 +164,6 @@ where }, ), }; - list.render(props, &mut props_mut, area, buf); + list.render(props, props_mut, area, buf); } } diff --git a/src/interactive/widgets/footer.rs b/src/interactive/widgets/footer.rs index e870091..16280fd 100644 --- a/src/interactive/widgets/footer.rs +++ b/src/interactive/widgets/footer.rs @@ -25,7 +25,7 @@ impl Component for ReactFooter { fn render( &mut self, props: impl Borrow<Self::Props>, - props_mut: &mut Self::PropsMut, + props_mut: impl BorrowMut<Self::PropsMut>, area: Rect, buf: &mut Buffer, ) { diff --git a/src/interactive/widgets/help.rs b/src/interactive/widgets/help.rs index 5b84e39..bfc6099 100644 --- a/src/interactive/widgets/help.rs +++ b/src/interactive/widgets/help.rs @@ -25,7 +25,7 @@ impl Component for ReactHelpPane { fn render( &mut self, props: impl Borrow<Self::Props>, - _props_mut: &mut Self::PropsMut, + _props_mut: impl BorrowMut<Self::PropsMut>, area: Rect, buf: &mut Buffer, ) { diff --git a/src/interactive/widgets/main.rs b/src/interactive/widgets/main.rs index 4bbef95..4e93160 100644 --- a/src/interactive/widgets/main.rs +++ b/src/interactive/widgets/main.rs @@ -36,7 +36,7 @@ impl<'a, 'b> Component for ReactMainWindow { fn render( &mut self, props: impl Borrow<TerminalApp>, - _props_mut: &mut Self::PropsMut, + _props_mut: impl BorrowMut<Self::PropsMut>, area: Rect, buf: &mut Buffer, ) { @@ -112,7 +112,7 @@ impl<'a, 'b> Component for ReactMainWindow { let props = ReactHelpPaneProps { border_style: help_style, }; - pane.render(props, &mut (), help_area, buf); + pane.render(props, (), help_area, buf); } ReactFooter.render( @@ -122,7 +122,7 @@ impl<'a, 'b> Component for ReactMainWindow { format: display.byte_format, message: state.message.clone(), }, - &mut (), + (), footer_area, buf, ); |