1///|
2pub fn[T : trait Getter {
get(ConstPtr[Self]) -> Self
}
Getter] type ConstPtr[T]
ConstPtr::(self : ConstPtr[T]) -> T
get(ConstPtr[T]
self : type ConstPtr[T]
ConstPtr[type parameter T
T]) -> type parameter T
T {
3 type parameter
T::(ConstPtr[T]) -> T
get(ConstPtr[T]
self)
4}
5
6///|
7pub fn[T] type ConstPtr[T]
ConstPtr::(self : ConstPtr[T], other : ConstPtr[T]) -> Int
compare(ConstPtr[T]
self : type ConstPtr[T]
ConstPtr[type parameter T
T], ConstPtr[T]
other : type ConstPtr[T]
ConstPtr[type parameter T
T]) -> Int
Int {
8 (ptr : ConstPtr[Byte], other : ConstPtr[Byte]) -> Int64
pointer_sub((x : ConstPtr[T]) -> ConstPtr[Byte]
unsafe_coerce(ConstPtr[T]
self), (x : ConstPtr[T]) -> ConstPtr[Byte]
unsafe_coerce(ConstPtr[T]
other)).(self : Int64) -> Int
Converts a 64-bit signed integer to a 32-bit signed integer by truncating
higher bits.
Parameters:
value : The 64-bit signed integer (Int64) to be converted.
Returns a 32-bit signed integer (Int). Note that values outside the range
of 32-bit integers will be truncated, potentially leading to loss of
information.
Example:
let small = 42L
let big = 2147483648L // 2^31
inspect(small.to_int(), content="42")
inspect(big.to_int(), content="-2147483648") // Truncated to Int.min_value
to_int()
9}
10
11///|
12pub fn[T : trait Sized {
size() -> Int64
}
Sized] type ConstPtr[T]
ConstPtr::(self : ConstPtr[T], offset : Int64) -> ConstPtr[T]
add(
13 ConstPtr[T]
self : type ConstPtr[T]
ConstPtr[type parameter T
T],
14 Int64
offset : Int64
Int64
15) -> type ConstPtr[T]
ConstPtr[type parameter T
T] {
16 ConstPtr[T]
self |> (x : ConstPtr[T]) -> ConstPtr[Byte]
unsafe_coerce |> (ptr : ConstPtr[Byte], offset : Int64) -> ConstPtr[Byte]
pointer_add(Int64
offset (self : Int64, other : Int64) -> Int64
Multiplies two 64-bit integers.
Parameters:
self : The first 64-bit integer operand.
other : The second 64-bit integer operand.
Returns the product of the two 64-bit integers. If the result overflows the
range of Int64, it will be truncated according to two's complement
arithmetic.
Example:
let a = 42L
let b = 100L
inspect(a * b, content="4200")
let c = -42L
inspect(c * b, content="-4200")
* type parameter
T::() -> Int64
size()) |> (x : ConstPtr[Byte]) -> ConstPtr[T]
unsafe_coerce
17}
18
19///|
20pub fn[T : trait Sized {
size() -> Int64
}
Sized] type ConstPtr[T]
ConstPtr::(self : ConstPtr[T], other : ConstPtr[T]) -> Int64
sub(
21 ConstPtr[T]
self : type ConstPtr[T]
ConstPtr[type parameter T
T],
22 ConstPtr[T]
other : type ConstPtr[T]
ConstPtr[type parameter T
T]
23) -> Int64
Int64 {
24 let ConstPtr[Byte]
lhs = (x : ConstPtr[T]) -> ConstPtr[Byte]
unsafe_coerce(ConstPtr[T]
self)
25 let ConstPtr[Byte]
rhs = (x : ConstPtr[T]) -> ConstPtr[Byte]
unsafe_coerce(ConstPtr[T]
other)
26 (ptr : ConstPtr[Byte], other : ConstPtr[Byte]) -> Int64
pointer_sub(ConstPtr[Byte]
lhs, ConstPtr[Byte]
rhs) (self : Int64, other : Int64) -> Int64
Performs integer division between two 64-bit integers. Truncates the result
towards zero.
Parameters:
self : The dividend (the number to be divided).
other : The divisor (the number to divide by).
Returns the quotient of the division.
Throws a panic if other is zero.
Example:
let a = 42L
let b = 5L
inspect(a / b, content="8")
let c = -42L
let d = 5L
inspect(c / d, content="-8")
/ type parameter
T::() -> Int64
size()
27}
28
29///|
30pub fn[T] type ConstPtr[T]
ConstPtr::(rc : Rc[FixedArray[T]]) -> ConstPtr[T]
from_rc_fixedarray(Rc[FixedArray[T]]
rc : type Rc[T]
Rc[type FixedArray[A]
FixedArray[type parameter T
T]]) -> type ConstPtr[T]
ConstPtr[type parameter T
T] {
31 (x : Rc[FixedArray[T]]) -> ConstPtr[T]
unsafe_coerce(Rc[FixedArray[T]]
rc)
32}
33
34///|
35pub fn[T] type ConstPtr[T]
ConstPtr::(rc : Rc[Bytes]) -> ConstPtr[T]
from_rc_bytes(Rc[Bytes]
rc : type Rc[T]
Rc[Bytes
Bytes]) -> type ConstPtr[T]
ConstPtr[type parameter T
T] {
36 (x : Rc[Bytes]) -> ConstPtr[T]
unsafe_coerce(Rc[Bytes]
rc)
37}
38
39///|
40pub fn[T] type ConstPtr[T]
ConstPtr::(rc : Rc[String]) -> ConstPtr[T]
from_rc_string(Rc[String]
rc : type Rc[T]
Rc[String
String]) -> type ConstPtr[T]
ConstPtr[type parameter T
T] {
41 (x : Rc[String]) -> ConstPtr[T]
unsafe_coerce(Rc[String]
rc)
42}
43