Skip to content

0.2.1

Compare
Choose a tag to compare
@dtolnay dtolnay released this 19 Sep 15:29
· 257 commits to master since this release
0.2.1
8355779
  • Add an unstable feature that changes the implementation to be a Macros 2.0 macro. This is required in call sites that need a string literal rather than just a &'static str, such as in a format string. (#12)

    [dependencies]
    indoc = { version = "0.2.1", features = ["unstable"] }
    #![feature(proc_macro)]
    
    extern crate indoc;
    use indoc::indoc;
    
    fn main() {
        let username = "Boscop";
        let body = "Check this out";
    
        let message = format!(
            indoc!("
                Hello {username}
                ======{underline}
    
                {body}
            "),
            username = username,
            underline = "=".repeat(username.len()),
            body = body,
        );
        print!("{}", message);
    }