cursor/
cursor.rs

1use chic::Error;
2use std::io::Cursor;
3
4fn main() {
5    let cursor = Cursor::new(
6        r#"This is an example
7content of the slice
8which will be annotated
9with the list of annotations below.
10"#,
11    );
12
13    let line = 1;
14    let start = cursor.position() as usize;
15    let end = cursor.get_ref().len() as usize;
16    let code = cursor.into_inner();
17
18    let msg = Error::new("expected type, found `x`")
19        .error(line, start, end, code, "found `x`")
20        .help("try using a foobs instead")
21        .to_string();
22
23    println!("{}", msg);
24}