1
Fork 0

std: Add a to_str impl for json::error.

This commit is contained in:
Erick Tryzelaar 2012-06-11 08:32:38 -07:00 committed by Graydon Hoare
parent ac4ac328ee
commit a816176eb5
2 changed files with 10 additions and 3 deletions

View file

@ -603,6 +603,12 @@ impl of to_str::to_str for json {
fn to_str() -> str { to_str(self) }
}
impl of to_str::to_str for error {
fn to_str() -> str {
#fmt("%u:%u: %s", self.line, self.col, self.msg)
}
}
#[cfg(test)]
mod tests {
fn mk_dict(items: [(str, json)]) -> json {