1///|
2pub fn[A, B] unsafe_coerce(x : type parameter A
A) -> type parameter B
B = "%identity"
3
4///|
5extern "c" fn _release(rc : type Rc[T]
Rc[Unit
Unit]) = "moonbit_decref"
6
7///|
8pub fn[T] type Rc[T]
Rc::(self : Rc[T]) -> Unit
release(Rc[T]
self : type Rc[T]
Rc[type parameter T
T]) -> Unit
Unit {
9 (x : (Rc[Unit]) -> Unit) -> (Rc[T]) -> Unit
unsafe_coerce((rc : Rc[Unit]) -> Unit
_release)(Rc[T]
self)
10}
11
12///|
13pub fn type Rc[T]
Rc::from_bytes(xs : Bytes
Bytes) -> type Rc[T]
Rc[Bytes
Bytes] = "%identity"
14
15///|
16pub fn[T] type Rc[T]
Rc::from_fixedarray(xs : type FixedArray[A]
FixedArray[type parameter T
T]) -> type Rc[T]
Rc[type FixedArray[A]
FixedArray[type parameter T
T]] = "%identity"
17
18///|
19pub fn[R] type Rc[T]
Rc::(xs : Bytes, f : (ConstPtr[Byte], Int) -> R) -> R
scope_bytes(Bytes
xs : Bytes
Bytes, (ConstPtr[Byte], Int) -> R
f : (type ConstPtr[T]
ConstPtr[Byte
Byte], Int
Int) -> type parameter R
R) -> type parameter R
R {
20 let Rc[Bytes]
rc = type Rc[T]
Rc::(xs : Bytes) -> Rc[Bytes]
from_bytes(Bytes
xs)
21 let ConstPtr[Byte]
ptr : type ConstPtr[T]
ConstPtr[Byte
Byte] = (x : Rc[Bytes]) -> ConstPtr[Byte]
unsafe_coerce(Rc[Bytes]
rc)
22 let R
result = (ConstPtr[Byte], Int) -> R
f(ConstPtr[Byte]
ptr, Bytes
xs.(self : Bytes) -> Int
Returns the number of bytes in a byte sequence.
Parameters:
bytes : The byte sequence whose length is to be determined.
Returns an integer representing the length (number of bytes) of the sequence.
Example:
let bytes = b"\x01\x02\x03"
inspect(bytes.length(), content="3")
let empty = b""
inspect(empty.length(), content="0")
length())
23 Rc[Bytes]
rc.(self : Rc[Bytes]) -> Unit
release()
24 R
result
25}
26
27///|
28pub fn[T, R] type Rc[T]
Rc::(xs : FixedArray[T], f : (Ptr[T], Int) -> R) -> R
scope_fixedarray(
29 FixedArray[T]
xs : type FixedArray[A]
FixedArray[type parameter T
T],
30 (Ptr[T], Int) -> R
f : (type Ptr[T]
Ptr[type parameter T
T], Int
Int) -> type parameter R
R
31) -> type parameter R
R {
32 let Rc[FixedArray[T]]
rc = type Rc[T]
Rc::(xs : FixedArray[T]) -> Rc[FixedArray[T]]
from_fixedarray(FixedArray[T]
xs)
33 let Ptr[T]
ptr : type Ptr[T]
Ptr[type parameter T
T] = (x : Rc[FixedArray[T]]) -> Ptr[T]
unsafe_coerce(Rc[FixedArray[T]]
rc)
34 let R
result = (Ptr[T], Int) -> R
f(Ptr[T]
ptr, FixedArray[T]
xs.(self : FixedArray[T]) -> Int
Returns the number of elements in a fixed-size array.
Parameters:
array : The fixed-size array whose length is to be determined.
Returns an integer representing the number of elements in the array.
Example:
let arr = FixedArray::make(3, 42)
inspect(arr.length(), content="3")
length())
35 Rc[FixedArray[T]]
rc.(self : Rc[FixedArray[T]]) -> Unit
release()
36 R
result
37}
38