live2d_parser/lib.rs
1#![allow(unused)]
2pub mod cubism_v1;
3pub mod cubism_v3;
4mod errors;
5pub mod helpers;
6
7pub use crate::{cubism_v1::ModelJson, cubism_v3::Model3Json, errors::L2Error};
8use serde::{Deserialize, Serialize};
9
10#[derive(Serialize, Deserialize)]
11#[serde(untagged)]
12pub enum Live2DModel {
13 V1(ModelJson),
14 V3(Model3Json),
15}
16
17impl Live2DModel {
18 pub fn from_str(s: &str) -> Result<Self, serde_json::Error> {
19 Ok(serde_json::from_str::<Live2DModel>(s)?)
20 }
21}