mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
fix warnings; 27.2% cov
This commit is contained in:
parent
5352a9d548
commit
d5a304e645
5 changed files with 19 additions and 9 deletions
|
|
@ -9,8 +9,7 @@ pub(crate) use self::Value::*;
|
||||||
pub(crate) use self::ParseError::*;
|
pub(crate) use self::ParseError::*;
|
||||||
pub(crate) use konst::iter::{ConstIntoIter, IsIteratorKind};
|
pub(crate) use konst::iter::{ConstIntoIter, IsIteratorKind};
|
||||||
pub(crate) use konst::string::{split_at, str_range, char_indices};
|
pub(crate) use konst::string::{split_at, str_range, char_indices};
|
||||||
pub(crate) use std::error::Error;
|
pub(crate) use std::fmt::Debug;
|
||||||
pub(crate) use std::fmt::{Debug, Display, Formatter, Result as FormatResult};
|
|
||||||
/// Static iteration helper.
|
/// Static iteration helper.
|
||||||
#[macro_export] macro_rules! iterate {
|
#[macro_export] macro_rules! iterate {
|
||||||
($expr:expr => $arg: pat => $body:expr) => {
|
($expr:expr => $arg: pat => $body:expr) => {
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,18 @@ impl<'a, E: Output> Content<E> for RenderBox<'a, E> {
|
||||||
pub type RenderDyn<'a, E> = dyn Render<E> + Send + Sync + 'a;
|
pub type RenderDyn<'a, E> = dyn Render<E> + Send + Sync + 'a;
|
||||||
/// You can render from an opaque pointer.
|
/// You can render from an opaque pointer.
|
||||||
impl<'a, E: Output> Content<E> for &RenderDyn<'a, E> where Self: Sized {
|
impl<'a, E: Output> Content<E> for &RenderDyn<'a, E> where Self: Sized {
|
||||||
fn content (&self) -> impl Render<E> { self.deref() }
|
fn content (&self) -> impl Render<E> {
|
||||||
fn layout (&self, area: E::Area) -> E::Area { Render::layout(self.deref(), area) }
|
#[allow(suspicious_double_ref_op)]
|
||||||
fn render (&self, output: &mut E) { Render::render(self.deref(), output) }
|
self.deref()
|
||||||
|
}
|
||||||
|
fn layout (&self, area: E::Area) -> E::Area {
|
||||||
|
#[allow(suspicious_double_ref_op)]
|
||||||
|
Render::layout(self.deref(), area)
|
||||||
|
}
|
||||||
|
fn render (&self, output: &mut E) {
|
||||||
|
#[allow(suspicious_double_ref_op)]
|
||||||
|
Render::render(self.deref(), output)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// Composable renderable with static dispatch.
|
/// Composable renderable with static dispatch.
|
||||||
pub trait Content<E: Output> {
|
pub trait Content<E: Output> {
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@
|
||||||
in pkgs.mkShell.override {
|
in pkgs.mkShell.override {
|
||||||
inherit stdenv;
|
inherit stdenv;
|
||||||
} {
|
} {
|
||||||
inherit name nativeBuildInputs buildInputs VST3_SDK_DIR LIBCLANG_PATH LD_LIBRARY_PATH;
|
inherit name nativeBuildInputs buildInputs LIBCLANG_PATH LD_LIBRARY_PATH;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ pub fn buffer_update (buf: &mut Buffer, area: [u16;4], callback: &impl Fn(&mut C
|
||||||
for col in 0..area.w() {
|
for col in 0..area.w() {
|
||||||
let x = area.x() + col;
|
let x = area.x() + col;
|
||||||
if x < buf.area.width && y < buf.area.height {
|
if x < buf.area.width && y < buf.area.height {
|
||||||
callback(buf.get_mut(x, y), col, row);
|
if let Some(cell) = buf.cell_mut(ratatui::prelude::Position { x, y }) {
|
||||||
|
callback(cell, col, row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ impl TuiOut {
|
||||||
if exited.fetch_and(true, Relaxed) {
|
if exited.fetch_and(true, Relaxed) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
let t0 = engine.read().unwrap().perf.get_t0();
|
//let t0 = engine.read().unwrap().perf.get_t0();
|
||||||
let Size { width, height } = engine.read().unwrap().backend.size()
|
let Size { width, height } = engine.read().unwrap().backend.size()
|
||||||
.expect("get size failed");
|
.expect("get size failed");
|
||||||
if let Ok(state) = state.try_read() {
|
if let Ok(state) = state.try_read() {
|
||||||
|
|
@ -50,7 +50,7 @@ impl TuiOut {
|
||||||
state.render(&mut output);
|
state.render(&mut output);
|
||||||
buffer = engine.write().unwrap().flip(output.buffer, size);
|
buffer = engine.write().unwrap().flip(output.buffer, size);
|
||||||
}
|
}
|
||||||
let t1 = engine.read().unwrap().perf.get_t1(t0).unwrap();
|
//let t1 = engine.read().unwrap().perf.get_t1(t0).unwrap();
|
||||||
//buffer.set_string(0, 0, &format!("{:>3}.{:>3}ms", t1.as_millis(), t1.as_micros() % 1000), Style::default());
|
//buffer.set_string(0, 0, &format!("{:>3}.{:>3}ms", t1.as_millis(), t1.as_micros() % 1000), Style::default());
|
||||||
std::thread::sleep(timer);
|
std::thread::sleep(timer);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue