ldtk2

Crates.ioldtk2
lib.rsldtk2
version0.8.0
sourcesrc
created_at2021-02-12 05:59:50.288989
updated_at2024-03-11 02:18:10.155181
descriptionA thin crate for people who just want to use ldtk files freely
homepagehttps://github.com/sumibi-yakitori/ldtk2-rs
repositoryhttps://github.com/sumibi-yakitori/ldtk2-rs
max_upload_size
id354058
size73,831
(sumibi-yakitori)

documentation

https://docs.rs/ldtk2

README

Crates.io Documentation License Workflow Status

ldtk2

A thin crate for people who just want to use ldtk files freely.

Why did I create this nonsense?

  • 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.

Supported LDtk file versions

^1.5

Usage

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(())
}
Commit count: 43

cargo fmt