Standard Library Reference
Cross-target helpers live under std::. Bare calls such as min(a, b) or sha256(data) are rejected (V49) — use the qualified forms. A std:: name outside the functions listed here is rejected on both targets (E25).
Authoritative tables also live in cambrian-lang docs/STDLIB.md.
std::math
| Function | Role |
|---|---|
min, max, minmax | Ordering |
abs, sign | Sign |
clamp | Range clamp |
muldiv, muldivmod | Widening multiply-then-divide (muldivmod returns quotient and remainder; EVM only — no Lean lowering, L16) |
divmod, divc, divr | Division variants |
modpow2, pow | Powers |
std::str
| Function | Role |
|---|---|
parse_u8, parse_u16, parse_u32, parse_u64, parse_u128, parse_U256 | (s: String, radix) -> Option<uN> |
parse_i8, parse_i16, parse_i32, parse_i64, parse_i128 | (s: String, radix) -> Option<iN> |
parse_uint / parse_int | Aliases of parse_u64 / parse_i64 |
format | Rust-style format string: std::str::format("{:06}", x) |
A parse returns none on an empty string, an invalid digit, or a bad radix.
String ↔ number conversion is never implicit (V50): use parse_* / format.
pure fn parse_or_zero(s: String) -> u64 {
match std::str::parse_u64(s, 10) {
some(n) => n,
none => 0,
}
}
std::crypto
| Function | Role |
|---|---|
sha256 | SHA-256 digest of bytes / String. EVM only — no Lean lowering (L13) |
A user pure fn may reuse a std:: function name (min, pow, …): a bare
min(a, b) then calls the user function, while std::math::min(a, b) always
calls the standard library. V49 fires on a bare call only when no user
function of that name exists.
Related namespaces (not std::)
| Namespace | Docs |
|---|---|
msg:: | Message Context |
sys:: | System Context |
evm:: | EVM Intrinsics |