revert widget trait
This commit is contained in:
1 parent
2176da4d75
commit
4aaf790ae9
2 files changed
+4
-5
No files matched your search
@@ -43,7 +43,7 @@ pub(crate) fn render_vnode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> RinkWidget for Label<'a> {
|
impl<'a> RinkWidget for Label<'a> {
|
||||||
fn render(self, area: Rect, buf: &mut RinkBuffer) {
|
fn render(self, area: Rect, mut buf: RinkBuffer) {
|
||||||
for (i, c) in self.text.char_indices() {
|
for (i, c) in self.text.char_indices() {
|
||||||
let mut new_cell = RinkCell::default();
|
let mut new_cell = RinkCell::default();
|
||||||
new_cell.set_style(self.style);
|
new_cell.set_style(self.style);
|
||||||
@@ -81,7 +81,7 @@ pub(crate) fn render_vnode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RinkWidget for &Node {
|
impl RinkWidget for &Node {
|
||||||
fn render(self, area: Rect, mut buf: &mut RinkBuffer<'_>) {
|
fn render(self, area: Rect, mut buf: RinkBuffer<'_>) {
|
||||||
use tui::symbols::line::*;
|
use tui::symbols::line::*;
|
||||||
|
|
||||||
enum Direction {
|
enum Direction {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ impl<'a> RinkBuffer<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub trait RinkWidget {
|
pub trait RinkWidget {
|
||||||
fn render(self, area: Rect, buf: &mut RinkBuffer);
|
fn render(self, area: Rect, buf: RinkBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct WidgetWithContext<T: RinkWidget> {
|
pub struct WidgetWithContext<T: RinkWidget> {
|
||||||
@@ -57,8 +57,7 @@ impl<T: RinkWidget> WidgetWithContext<T> {
|
|||||||
|
|
||||||
impl<T: RinkWidget> Widget for WidgetWithContext<T> {
|
impl<T: RinkWidget> Widget for WidgetWithContext<T> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||||
let mut rbuf = RinkBuffer::new(buf, self.config);
|
self.widget.render(area, RinkBuffer::new(buf, self.config));
|
||||||
self.widget.render(area, &mut rbuf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user