19 lines
428 B
Rust
19 lines
428 B
Rust
// expect: run
|
|
// result: 42
|
|
// phase: 6
|
|
// spec: docs/spec/16-standard-library.md
|
|
module demo.standard
|
|
import std.bytes;
|
|
import std.math;
|
|
|
|
fn main() -> u64
|
|
effects []
|
|
{
|
|
var data: [u8; 4] = zero;
|
|
std.bytes.fill(mut data, 65);
|
|
assert(std.bytes.equal(ref data, b"AAAA"));
|
|
let index = std.bytes.find(ref data, 65);
|
|
if index < data.len { assert(data[index] == 65); }
|
|
return std.math.clamp_u64(42, 0, 100);
|
|
}
|