Crates.io | source-error |
lib.rs | source-error |
version | 0.1.0 |
source | src |
created_at | 2019-09-25 10:04:19.851551 |
updated_at | 2019-09-25 10:27:24.189025 |
description | A magical type for displaying source file errors |
homepage | https://github.com/softprops/source-error |
repository | https://github.com/softprops/source-error |
max_upload_size | |
id | 167527 |
size | 91,355 |
a magical type for displaying source file errors
Add the following to your Cargo.toml
file's [dependencies]
heading
[dependencies]
source-error = "0.1"
🚧 Interfaces are not yet finalized and are subject to change
This crate is intended as a visual reporting diagnostic for tools which operate on text sources.
The source_error::Error
type provides a helpful Display
and can be used on in any Error
context
use source_error::{from_file, Position};
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
println!(
"{}",
from_file(
"whoopsie!",
"path/to/some/file.json",
Position::new(3, 4)
)?
);
Ok(())
}
Doug Tangren (softprops) 2019