Impl spanned functions
This commit is contained in:
@@ -2,7 +2,7 @@ use <std::fmt::Formatter>;
|
|||||||
use <std::fmt>;
|
use <std::fmt>;
|
||||||
|
|
||||||
pub trait TestLogging<T: fmt::Display>: fmt::Display {
|
pub trait TestLogging<T: fmt::Display>: fmt::Display {
|
||||||
String get();
|
String get(self*);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum LogLevel {
|
pub enum LogLevel {
|
||||||
@@ -29,6 +29,12 @@ impl fmt::Display for LogLevel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl TestLogging<LogLevel> for LogLevel {
|
||||||
|
String get(self*) {
|
||||||
|
return format!("{self}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub class Logger {
|
pub class Logger {
|
||||||
String prefix;
|
String prefix;
|
||||||
|
|
||||||
@@ -55,7 +61,7 @@ pub class Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogLevel::Warning => {
|
LogLevel::Warning => {
|
||||||
println!("{level} {} {}", self.prefix, message);
|
println!("{} {} {}", level.get(), self.prefix, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogLevel::Error => {
|
LogLevel::Error => {
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ pub struct ImplDecl {
|
|||||||
pub generics: GenericsDecl,
|
pub generics: GenericsDecl,
|
||||||
pub target: TypeExpr,
|
pub target: TypeExpr,
|
||||||
pub trait_: Option<TypeExpr>,
|
pub trait_: Option<TypeExpr>,
|
||||||
pub methods: Vec<FunctionDecl>,
|
pub methods: Vec<Spanned<FunctionDecl>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
|||||||
Reference in New Issue
Block a user