mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Start style-spec crate
This commit is contained in:
parent
430d6f368b
commit
95f6447108
1
libs/style_spec/.gitignore
vendored
Normal file
1
libs/style_spec/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
style-spec-v8.json
|
||||
18
libs/style_spec/Cargo.toml
Normal file
18
libs/style_spec/Cargo.toml
Normal file
@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "style-spec"
|
||||
version = "0.1.0"
|
||||
description = "A library for decoding style specs"
|
||||
readme = "README.md"
|
||||
categories = ["encoding"]
|
||||
edition = "2021"
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
log = "0.4"
|
||||
|
||||
|
||||
|
||||
[build-dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
|
||||
26
libs/style_spec/build.rs
Normal file
26
libs/style_spec/build.rs
Normal file
@ -0,0 +1,26 @@
|
||||
use std::fs::File;
|
||||
use std::io::BufReader;
|
||||
use serde_json::Value;
|
||||
|
||||
fn generate_type_def() -> Option<u32> {
|
||||
let mut f = File::open("style-spec-v8.json").unwrap();
|
||||
let mut reader = BufReader::new(f);
|
||||
let result = serde_json::from_reader::<_, Value>(&mut reader).unwrap();
|
||||
|
||||
let spec_root = result.as_object()?;
|
||||
let version = &spec_root["$version"].as_i64()?;
|
||||
let root = &spec_root["$root"].as_object()?;
|
||||
|
||||
for x in spec_root {
|
||||
|
||||
}
|
||||
|
||||
println!("cargo:warning={:?}", version);
|
||||
|
||||
Some(5)
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
generate_type_def();
|
||||
}
|
||||
0
libs/style_spec/src/lib.rs
Normal file
0
libs/style_spec/src/lib.rs
Normal file
Loading…
x
Reference in New Issue
Block a user