dwbase_wit_guest/
lib.rs

1//! Guest-side helpers for DWBase WIT interfaces.
2//!
3//! Currently provides a minimal wrapper around the WIT definitions plus a parser smoke test to
4//! ensure the interface stays in sync.
5
6use serde::{Deserialize, Serialize};
7
8#[derive(Clone, Debug, Serialize, Deserialize)]
9pub struct ClientConfig {
10    pub world: String,
11}
12
13impl Default for ClientConfig {
14    fn default() -> Self {
15        Self {
16            world: "default".into(),
17        }
18    }
19}
20
21#[cfg(test)]
22mod tests {
23    use std::path::Path;
24    use wit_parser::UnresolvedPackageGroup;
25
26    #[test]
27    fn wit_files_parse() {
28        let group =
29            UnresolvedPackageGroup::parse_path(Path::new("../../wit/dwbase-types.wit")).unwrap();
30        let mut names = Vec::new();
31        names.push(group.main.name.name.as_str());
32        for pkg in &group.nested {
33            names.push(pkg.name.name.as_str());
34        }
35        assert!(names.contains(&"types"));
36    }
37}