pub struct GeneratedFile {
pub path: String,
pub contents: String,
}Expand description
A single generated file, addressed by a path relative to the project root.
§Examples
A GeneratedFile is produced by generate_project; you typically inspect
it by path:
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();
let lib = project.files.iter().find(|f| f.path == "rust/src/lib.rs").unwrap();
assert!(lib.contents.contains("pub struct Wallet"));Fields§
§path: String§contents: StringTrait Implementations§
Source§impl Clone for GeneratedFile
impl Clone for GeneratedFile
Auto Trait Implementations§
impl Freeze for GeneratedFile
impl RefUnwindSafe for GeneratedFile
impl Send for GeneratedFile
impl Sync for GeneratedFile
impl Unpin for GeneratedFile
impl UnsafeUnpin for GeneratedFile
impl UnwindSafe for GeneratedFile
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