pub struct Project {
pub files: Vec<GeneratedFile>,
pub has_rust: bool,
pub has_go: bool,
pub has_ffi: bool,
pub has_python: bool,
pub diagnostics: Vec<RoutingDiagnostic>,
}Expand description
A fully assembled dual-backend project.
Fields§
§files: Vec<GeneratedFile>§has_rust: bool§has_go: bool§has_ffi: bool§has_python: bool§diagnostics: Vec<RoutingDiagnostic>Routing diagnostics (e.g. real_time + Go conflicts) collected during module routing. Callers should surface these as warnings.
Implementations§
Source§impl Project
impl Project
Sourcepub fn write(&self, root: &Path) -> Result<()>
pub fn write(&self, root: &Path) -> Result<()>
Write every generated file under root, creating directories as needed.
§Examples
use tpt_telos_parser::parse;
use tpt_telos_agent::{StaticAgent, transpile_module};
use tpt_telos_codegen::generate_project;
let src = r#"
module Bank {
invariant Wallet { balance >= 0 }
func deposit(w: Wallet, amount: PositiveInt)
ensures w.balance == old(w.balance) + amount
;
}
"#;
let modules = parse(src).unwrap();
let outcomes: Vec<_> = modules.iter()
.flat_map(|m| transpile_module(m, &StaticAgent::new()).unwrap())
.collect();
let project = generate_project(&modules, &outcomes).unwrap();
project.write(std::path::Path::new("/tmp/my_bank_project")).unwrap();
// Writes rust/src/lib.rs, rust/Cargo.toml, and go/service.go etc.Trait Implementations§
Auto Trait Implementations§
impl Freeze for Project
impl RefUnwindSafe for Project
impl Send for Project
impl Sync for Project
impl Unpin for Project
impl UnsafeUnpin for Project
impl UnwindSafe for Project
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more