pub struct Toml;Expand description
Parser for the toml format: TOML into a source-located value tree.
Tables, arrays, and scalars map to the value tree with a per-node span Location; date-times
are rejected with Error::UnsupportedType. Stateless — construct with Toml::new.
use tanzim_parse::{Parse, toml::Toml};
use tanzim_source::SourceBuilder;
let source = SourceBuilder::new()
.with_source("file")
.with_resource("config.toml")
.build()
.unwrap();
let value = Toml::new().parse(&source, b"port = 8080\n", &[]).unwrap();
let port = value.value().as_map().unwrap().get("port").unwrap();
assert_eq!(port.value().as_int().unwrap(), 8080);Implementations§
Trait Implementations§
impl Copy for Toml
Auto Trait Implementations§
impl Freeze for Toml
impl RefUnwindSafe for Toml
impl Send for Toml
impl Sync for Toml
impl Unpin for Toml
impl UnsafeUnpin for Toml
impl UnwindSafe for Toml
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more