A thin crate for people who just want to use ldtk files freely.
- LDtk-rs
uses code generation, it does not get autocomplete support from rust-analyzer.Also, there are special license restrictions on using that crate. - ldtk_rust uses
.except()
inside the crate, you can't handle errors.
^1.5
cargo add ldtk2
use std::{error::Error, path::Path, convert::TryInto};
use ldtk2::Ldtk;
fn main() -> Result<(), Box<dyn Error>> {
let map = Ldtk::from_path("tests/example.ldtk")?;
// or
let map: Ldtk = Path::new("tests/example.ldtk").try_into()?;
// or
let map = Ldtk::from_str(include_str!("../tests/example.ldtk"))?;
// or
let map: Ldtk = include_str!("../tests/example.ldtk").try_into()?;
Ok(())
}