burn-import 0.14.0

Library for importing datamodels into the Burn framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use proc_macro2::TokenStream;
use rust_format::{Config, Edition, Formatter, PostProcess, RustFmt};

/// Formats a token stream into a string.
pub fn format_tokens(tokens: TokenStream) -> String {
    let fmt = code_formatter();

    fmt.format_tokens(tokens).expect("Valid token tree")
}

fn code_formatter() -> RustFmt {
    let config = Config::new_str()
        .post_proc(PostProcess::ReplaceMarkersAndDocBlocks)
        .edition(Edition::Rust2021);

    RustFmt::from_config(config)
}