Skip to content

Commit 5c05071

Browse files
committed
mv some trait
1 parent c0df1dd commit 5c05071

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

crates/lean_compiler/src/ir/simple_line/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,14 @@ use crate::{
2121
compiler::{Compile, CompileContext, CompileResult, Compiler, FindInternalVars},
2222
},
2323
lang::Var,
24+
traits::IndentedDisplay,
2425
};
2526
use lean_vm::Label;
2627
use std::{
2728
collections::BTreeSet,
2829
fmt::{Display, Formatter},
2930
};
3031

31-
/// Trait for displaying instructions with proper indentation.
32-
pub trait IndentedDisplay: Display {
33-
/// Returns a string representation with the specified indentation level.
34-
///
35-
/// Default implementation just adds indentation to the Display output.
36-
fn to_string_with_indent(&self, indent: usize) -> String {
37-
format!("{}{}", " ".repeat(indent), self)
38-
}
39-
}
40-
4132
pub use assignment::Assignment;
4233
pub use branch::Branch;
4334
pub use counter_hint::CounterHint;

crates/lean_compiler/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ mod lang;
1313
mod parser;
1414
mod passes;
1515
mod precompiles;
16+
pub mod traits;
1617
pub use precompiles::PRECOMPILES;
1718

1819
/// Compiles a program using the new pass architecture.

crates/lean_compiler/src/traits.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use std::fmt::Display;
2+
3+
/// Trait for displaying with proper indentation.
4+
pub trait IndentedDisplay: Display {
5+
/// Returns a string representation with the specified indentation level.
6+
///
7+
/// Default implementation just adds indentation to the Display output.
8+
fn to_string_with_indent(&self, indent: usize) -> String {
9+
format!("{}{}", " ".repeat(indent), self)
10+
}
11+
}

0 commit comments

Comments
 (0)