parol 4.5.0

LL(k) and LALR(1) parser generator for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use anyhow::{Result, anyhow};
use std::path::Path;

use std::process::Command;

// ---------------------------------------------------
// Part of the Public API
// *Changes will affect crate's version according to semver*
// ---------------------------------------------------
/// Tries to format the source code of a given file.
pub fn try_format(path_to_file: &Path) -> Result<()> {
    Command::new("rustfmt")
        .args([path_to_file])
        .args(["--edition", "2024"])
        .status()
        .map(|_| ())
        .map_err(|e| anyhow!("Error during source formatting!: {}", e))
}