Skip to content

Instantly share code, notes, and snippets.

@teticio
Last active December 26, 2021 18:19
Show Gist options
  • Save teticio/c00510d1b524a87d0abca4049e72d057 to your computer and use it in GitHub Desktop.
Save teticio/c00510d1b524a87d0abca4049e72d057 to your computer and use it in GitHub Desktop.
Jupyter notebook extension code prettifier configuration for Rust
"rust": {
"library": "extern crate serde_json; extern crate rustfmt;",
"prefix": "{ use std::fs::File; use serde_json::json; use crate::rustfmt::{format_input, Input, config::Config}; let config = Config::default(); let input = Input::Text(",
"postfix": ".into()); let (summary, filemap, _) = format_input::<File>(input, &config, Option::None).unwrap(); if summary.has_no_errors() { let (_, output) = &filemap[0]; println!(\"{}\", json!(output.to_string())); } }"
}
@teticio
Copy link
Author

teticio commented Dec 26, 2021

Add this to the configuration of the code prettifier nbextension to use with the Rust EvCxR Jupyter kernel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment