Export all types at top level

This commit is contained in:
Joscha 2023-02-16 09:18:08 +01:00
parent 0d59116012
commit 4ffaae067e
9 changed files with 21 additions and 23 deletions

View file

@ -1,7 +1,6 @@
use crossterm::event::Event; use crossterm::event::Event;
use crossterm::style::{ContentStyle, Stylize}; use crossterm::style::{ContentStyle, Stylize};
use toss::frame::{Frame, Pos}; use toss::{Frame, Pos, Terminal};
use toss::terminal::Terminal;
fn draw(f: &mut Frame) { fn draw(f: &mut Frame) {
f.write( f.write(

View file

@ -1,7 +1,6 @@
use crossterm::event::Event; use crossterm::event::Event;
use crossterm::style::{ContentStyle, Stylize}; use crossterm::style::{ContentStyle, Stylize};
use toss::frame::{Frame, Pos}; use toss::{Frame, Pos, Terminal};
use toss::terminal::Terminal;
fn draw(f: &mut Frame) { fn draw(f: &mut Frame) {
f.write( f.write(

View file

@ -1,7 +1,5 @@
use crossterm::event::Event; use crossterm::event::Event;
use toss::frame::{Frame, Pos}; use toss::{Frame, Pos, Styled, Terminal};
use toss::styled::Styled;
use toss::terminal::Terminal;
fn draw(f: &mut Frame) { fn draw(f: &mut Frame) {
let text = concat!( let text = concat!(

View file

@ -2,8 +2,7 @@ use std::ops::{Add, AddAssign, Neg, Range, Sub, SubAssign};
use crossterm::style::ContentStyle; use crossterm::style::ContentStyle;
use crate::styled::Styled; use crate::{Styled, WidthDb};
use crate::widthdb::WidthDb;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct Size { pub struct Size {

View file

@ -1,9 +1,7 @@
//! Rendering the next frame. //! Rendering the next frame.
use crate::buffer::Buffer; use crate::buffer::Buffer;
pub use crate::buffer::{Pos, Size}; use crate::{Pos, Size, Styled, WidthDb};
use crate::styled::Styled;
use crate::widthdb::WidthDb;
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct Frame { pub struct Frame {

View file

@ -10,8 +10,14 @@
#![warn(clippy::use_self)] #![warn(clippy::use_self)]
mod buffer; mod buffer;
pub mod frame; mod frame;
pub mod styled; mod styled;
pub mod terminal; mod terminal;
pub mod widthdb; mod widthdb;
mod wrap; mod wrap;
pub use buffer::{Pos, Size};
pub use frame::*;
pub use styled::*;
pub use terminal::*;
pub use widthdb::*;

View file

@ -1,5 +1,5 @@
use std::iter::Peekable; use std::iter::Peekable;
use std::{slice, vec}; use std::slice;
use crossterm::style::{ContentStyle, StyledContent}; use crossterm::style::{ContentStyle, StyledContent};
use unicode_segmentation::{GraphemeIndices, Graphemes, UnicodeSegmentation}; use unicode_segmentation::{GraphemeIndices, Graphemes, UnicodeSegmentation};

View file

@ -1,7 +1,7 @@
//! Displaying frames on a terminal. //! Displaying frames on a terminal.
use std::io::Write; use std::io::{self, Write};
use std::{io, mem}; use std::mem;
use crossterm::cursor::{Hide, MoveTo, Show}; use crossterm::cursor::{Hide, MoveTo, Show};
use crossterm::event::{ use crossterm::event::{
@ -12,9 +12,8 @@ use crossterm::style::{PrintStyledContent, StyledContent};
use crossterm::terminal::{Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen}; use crossterm::terminal::{Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen};
use crossterm::{ExecutableCommand, QueueableCommand}; use crossterm::{ExecutableCommand, QueueableCommand};
use crate::buffer::{Buffer, Size}; use crate::buffer::Buffer;
use crate::frame::Frame; use crate::{Frame, Size, WidthDb};
use crate::widthdb::WidthDb;
pub struct Terminal { pub struct Terminal {
/// Render target. /// Render target.

View file

@ -3,7 +3,7 @@
use unicode_linebreak::BreakOpportunity; use unicode_linebreak::BreakOpportunity;
use unicode_segmentation::UnicodeSegmentation; use unicode_segmentation::UnicodeSegmentation;
use crate::widthdb::WidthDb; use crate::WidthDb;
pub fn wrap(widthdb: &mut WidthDb, text: &str, width: usize) -> Vec<usize> { pub fn wrap(widthdb: &mut WidthDb, text: &str, width: usize) -> Vec<usize> {
let mut breaks = vec![]; let mut breaks = vec![];