1- use crate :: compiler:: { CompilerPhase , CompilerRunner , VisualizationMode , read_files_from_disk} ;
2- use crate :: ui;
3- use crate :: watcher:: FileWatcher ;
1+ use std:: { collections:: HashMap , path:: PathBuf , time:: Duration } ;
2+
43use anyhow:: Result ;
54use crossterm:: event:: { self , Event , KeyCode , KeyEvent , KeyModifiers , MouseEventKind } ;
6- use ratatui:: Terminal ;
7- use ratatui:: backend:: CrosstermBackend ;
8- use std:: collections:: HashMap ;
9- use std:: path:: PathBuf ;
10- use std:: time:: Duration ;
5+ use ratatui:: { Terminal , backend:: CrosstermBackend } ;
6+
7+ use crate :: {
8+ compiler:: { CompilerPhase , CompilerRunner , VisualizationMode , read_files_from_disk} ,
9+ ui,
10+ watcher:: FileWatcher ,
11+ } ;
1112
12- pub struct App {
13+ pub ( crate ) struct App {
1314 file_path : PathBuf ,
1415 /// Which tab is shown in the TUI.
1516 current_phase : CompilerPhase ,
@@ -28,7 +29,7 @@ pub struct App {
2829}
2930
3031impl App {
31- pub fn new ( path : PathBuf ) -> Result < Self > {
32+ pub ( crate ) fn new ( path : PathBuf ) -> Result < Self > {
3233 let watcher = FileWatcher :: new ( & path) ?;
3334 let mut compiler = CompilerRunner :: new ( & path) ;
3435
@@ -52,7 +53,7 @@ impl App {
5253 } )
5354 }
5455
55- pub fn run (
56+ pub ( crate ) fn run (
5657 & mut self ,
5758 terminal : & mut Terminal < CrosstermBackend < std:: io:: Stdout > > ,
5859 ) -> Result < ( ) > {
@@ -193,42 +194,42 @@ impl App {
193194 Ok ( ( ) )
194195 }
195196
196- pub fn current_phase ( & self ) -> CompilerPhase {
197+ pub ( crate ) fn current_phase ( & self ) -> CompilerPhase {
197198 self . current_phase
198199 }
199200
200- pub fn current_output ( & self ) -> & str {
201+ pub ( crate ) fn current_output ( & self ) -> & str {
201202 self . compiler
202203 . get_phase_output ( self . current_phase )
203204 . unwrap_or ( "No output available" )
204205 }
205206
206- pub fn snapshot_output ( & self ) -> Option < & str > {
207+ pub ( crate ) fn snapshot_output ( & self ) -> Option < & str > {
207208 self . snapshot_compiler
208209 . as_ref ( )
209210 . and_then ( |c| c. get_phase_output ( self . current_phase ) )
210211 }
211212
212- pub fn file_path ( & self ) -> & PathBuf {
213+ pub ( crate ) fn file_path ( & self ) -> & PathBuf {
213214 & self . file_path
214215 }
215216
216- pub fn has_snapshot ( & self ) -> bool {
217+ pub ( crate ) fn has_snapshot ( & self ) -> bool {
217218 self . snapshot_compiler . is_some ( )
218219 }
219220
220- pub fn scroll_offset ( & self ) -> u16 {
221+ pub ( crate ) fn scroll_offset ( & self ) -> u16 {
221222 self . scroll_offset
222223 }
223224
224- pub fn get_recomputation_status (
225+ pub ( crate ) fn get_recomputation_status (
225226 & self ,
226227 phase : CompilerPhase ,
227228 ) -> crate :: compiler:: RecomputationStatus {
228229 self . compiler . get_recomputation_status ( phase)
229230 }
230231
231- pub fn get_snapshot_recomputation_status (
232+ pub ( crate ) fn get_snapshot_recomputation_status (
232233 & self ,
233234 phase : CompilerPhase ,
234235 ) -> Option < crate :: compiler:: RecomputationStatus > {
@@ -237,15 +238,15 @@ impl App {
237238 . map ( |c| c. get_recomputation_status ( phase) )
238239 }
239240
240- pub fn get_output_annotated (
241+ pub ( crate ) fn get_output_annotated (
241242 & self ,
242243 phase : CompilerPhase ,
243244 ) -> Vec < ( String , crate :: compiler:: LineStatus ) > {
244245 self . compiler
245246 . get_annotated_output_with_mode ( phase, self . visualization_mode )
246247 }
247248
248- pub fn get_snapshot_output_annotated (
249+ pub ( crate ) fn get_snapshot_output_annotated (
249250 & self ,
250251 phase : CompilerPhase ,
251252 ) -> Option < Vec < ( String , crate :: compiler:: LineStatus ) > > {
@@ -255,11 +256,11 @@ impl App {
255256 } )
256257 }
257258
258- pub fn visualization_mode ( & self ) -> VisualizationMode {
259+ pub ( crate ) fn visualization_mode ( & self ) -> VisualizationMode {
259260 self . visualization_mode
260261 }
261262
262- pub fn visualization_mode_name ( & self ) -> & ' static str {
263+ pub ( crate ) fn visualization_mode_name ( & self ) -> & ' static str {
263264 match self . visualization_mode {
264265 VisualizationMode :: Diff => "Diff" ,
265266 VisualizationMode :: Salsa => "Salsa" ,
0 commit comments