data secret
A value hidden from logs and traces (§13.3). Serialized as T in the binary format; the JSON encoder rejects it
(§9.3). Show prints ***; secret<str> is wiped when dropped (D-2708, D-2711). Build it with secret(x) or
secret.of(x), read it with reveal() (a fresh copy).
Example:
fn main() io {
let key = secret("hunter2")
print("{key}")
print(key.reveal().len())
}Output
*** 7
@builtin("secret") pub(api) data secret<T>Thread safety. an immutable wrapper; `reveal()` makes a fresh copy.
Since. 1.0.0-beta
Methods
of | (value: T) -> secret<T>Wraps value; secret<str> keeps a private copy that is wiped on drop. |
reveal | () -> TThe wrapped value (a fresh copy). |
Defined in: std/core/types.oxl:665