Hi *,
How am i supposed to make function pointers part of enums which needs to have the Debug trait?
Here's the (simplyfied) example:
#[derive(Debug, Clone)]
enum Obj {
LIST(Vec<Obj>),
ATOM(Token),
NATIVE(NativeFunction),
NIL
}
type NativeFunction = fn(&Vec<Obj>) -> Obj;
impl fmt::Debug for NativeFunction {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
return write!(f, "here-goes-a-decent-representation");
}
} // This won't compile ....
I can not go without the Debug trait on Obj but have no idea how to attach a Debug trait on the native-function type in turn. What else could i do?