Move to Display rather than Debug for simple script runner
This commit is contained in:
parent
6739706b64
commit
02935fd8cf
10
src/main.rs
10
src/main.rs
@ -1,7 +1,7 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Display;
|
||||||
|
|
||||||
mod engine;
|
mod engine;
|
||||||
use engine::Engine;
|
use engine::Engine;
|
||||||
@ -21,10 +21,6 @@ mod parser;
|
|||||||
// * Method/dot access
|
// * Method/dot access
|
||||||
// * Comparison ops
|
// * Comparison ops
|
||||||
|
|
||||||
fn showit<T: Debug>(x: &mut T) -> () {
|
|
||||||
println!("{:?}", x)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
fn simple_fn(x: i32) -> bool { x == 1 }
|
fn simple_fn(x: i32) -> bool { x == 1 }
|
||||||
fn simple_fn2(x: &mut i32) -> bool { x.clone() == 2 }
|
fn simple_fn2(x: &mut i32) -> bool { x.clone() == 2 }
|
||||||
@ -174,6 +170,10 @@ fn test_var_scope() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn showit<T: Display>(x: &mut T) -> () {
|
||||||
|
println!("{}", x)
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut engine = Engine::new();
|
let mut engine = Engine::new();
|
||||||
&(showit as fn(x: &mut i32)->()).register(&mut engine, "print");
|
&(showit as fn(x: &mut i32)->()).register(&mut engine, "print");
|
||||||
|
Loading…
Reference in New Issue
Block a user