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())
}Вывод
*** 7
@builtin("secret") pub(api) data secret<T>Потокобезопасность. an immutable wrapper; `reveal()` makes a fresh copy.
С версии. 1.0.0-beta
Методы
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). |
Определено в: std/core/types.oxl:665