Skip to content

Commit

Permalink
Add toml_is_valid.
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Mar 9, 2024
1 parent ccde61f commit e747089
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/util/src/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
use meowtonin::{ByondError, ByondResult, ByondValue};
use std::path::PathBuf;

#[byond_fn]
pub fn toml_is_valid(toml: String) -> bool {
toml::from_str::<toml::Table>(&toml).is_ok()
}

#[byond_fn]
pub fn toml_decode(toml: String) -> ByondResult<ByondValue> {
toml::from_str::<toml::Table>(&toml)
Expand Down

0 comments on commit e747089

Please sign in to comment.