method i16.wrap
x.wrap<U>(): converts to the numeric type U; an integer that does not fit wraps around (keeps the low bits), a float is truncated toward zero (§3.1).
Example:
fn main() io {
let small: i16 = 200
let other: i16 = 300
let x: u8 = small.wrap<u8>()
let y: u8 = other.wrap<u8>()
print("{x} {y}")
}Вывод
200 44
pub(api) fn wrap<U>() -> UСложность. O(1).
С версии. 1.0.0-beta
Возвращает
U
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/numbers.oxl:887