Initial boilerplate scaffold for continuum-schemas
Protobuf data model (Template/PrintJob/MaterialProfile/PrintParameters) with codegen targets for TypeBox+TS types (packages/ts-types) and prost-derived Rust structs (packages/rust-types). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "continuum-rust-types"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "continuum_types"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
prost = "0.13"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
|
||||
[build-dependencies]
|
||||
prost-build = "0.13"
|
||||
@@ -0,0 +1,27 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
let proto_root = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("../../proto")
|
||||
.canonicalize()
|
||||
.expect("proto root must exist");
|
||||
|
||||
let proto_files = [
|
||||
proto_root.join("continuum/v1/material.proto"),
|
||||
proto_root.join("continuum/v1/print_params.proto"),
|
||||
proto_root.join("continuum/v1/template.proto"),
|
||||
proto_root.join("continuum/v1/print_job.proto"),
|
||||
];
|
||||
|
||||
for file in &proto_files {
|
||||
println!("cargo:rerun-if-changed={}", file.display());
|
||||
}
|
||||
|
||||
let mut config = prost_build::Config::new();
|
||||
config.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]");
|
||||
config.type_attribute(".", "#[serde(rename_all = \"camelCase\")]");
|
||||
|
||||
config
|
||||
.compile_protos(&proto_files, &[proto_root])
|
||||
.expect("failed to compile continuum .proto sources");
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
pub mod continuum {
|
||||
pub mod v1 {
|
||||
include!(concat!(env!("OUT_DIR"), "/continuum.v1.rs"));
|
||||
}
|
||||
}
|
||||
|
||||
pub use continuum::v1::{
|
||||
MaterialProfile, PrintJob, PrintJobStatus, PrintParameters, Template,
|
||||
};
|
||||
Reference in New Issue
Block a user