Registry / Framework

framework · v0.1.2
Sample Custody
Track custody of a field sample across dispatch and receipt with a matching seal number.
Use Sample Custody
use vendor::sample_custody::sample_custody;
Run the example
nest demo sample_custody@0.1.2
blyxc native-run sample_custody-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::sample_custody::sample_custody;
fn main() {
let arguments = cli_args();
if args_len(arguments) > 0 {
if args_len(arguments) % 2 != 0 {
stderr_line("Expected event and value pairs");
process_exit(2);
}
let mut live = sample_custody_start();
let mut i = 0;
while i < args_len(arguments) {
let input = args_at(arguments, i + 1);
if !text_is_number(input) {
stderr_line("Expected a whole numeric event value");
process_exit(2);
}
live = sample_custody_step(live, args_at(arguments, i), text_number(input));
let command = sample_custody_command(live);
println!(command);
if command == "reject" { process_exit(1); }
i += 2;
}
return;
}
let mut state = sample_custody_start();
state = sample_custody_step(state, "label", 12.0);
println!(sample_custody_command(state));
state = sample_custody_step(state, "dispatch", 12.0);
println!(sample_custody_command(state));
state = sample_custody_step(state, "receive", 13.0);
println!(sample_custody_command(state));
state = sample_custody_step(state, "reconcile", 12.0);
println!(sample_custody_command(state));
state = sample_custody_step(state, "archive", 12.0);
println!(sample_custody_command(state));
}
Expected output
print_seal
log_departure
quarantine_sample
release_quarantine
archive_record
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.2 | Download ZIP · Browse files | 9e0043f16b | 0ae5d72e16e5c0b5099efa43563bcb472b87ed2e4aece3dd79cbbd440fe673e8 |
| 0.1.1 | Download ZIP · Browse files | d427683db2 | 6955bef8daa656b159f4b21c8ee6a1727b361539bce185014771b4c6aa477d48 |
| 0.1.0 | Download ZIP · Browse files | 6349f23784 | b5c3f5ae37b33bd8fdeb1d05fca93e20ac39ada80ee296c244507904f52d0b83 |