#![cfg_attr(not(any(test, feature = "use-std")), no_std)]
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]
pub mod impls;
pub mod schema;
#[cfg(feature = "derive")]
pub use postcard_derive::Schema;
pub trait Schema {
const SCHEMA: &'static schema::NamedType;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn crate_path() {
#[allow(unused)]
#[derive(Schema)]
#[postcard(crate = crate)]
struct Point {
x: i32,
y: i32,
}
assert_eq!(
Point::SCHEMA,
&schema::NamedType {
name: "Point",
ty: &schema::DataModelType::Struct(&[
&schema::NamedValue {
name: "x",
ty: i32::SCHEMA
},
&schema::NamedValue {
name: "y",
ty: i32::SCHEMA
},
])
}
);
}
}