@@ -1670,92 +1670,92 @@ declare abstract class i31 {
1670
1670
1671
1671
declare namespace string {
1672
1672
/** Constructs a string reference from a string literal. Temporary! */
1673
- export function const_ ( str : string ) : stringref ;
1673
+ export function const_ ( str : string ) : ref_string ;
1674
1674
/** Creates a new string from memory using a strict UTF-8 decoder, decoding `bytes` bytes starting at `ptr`. */
1675
- export function new_utf8 ( ptr : usize , bytes : i32 ) : stringref ;
1675
+ export function new_utf8 ( ptr : usize , bytes : i32 ) : ref_string ;
1676
1676
/** Creates a new string from `array` using a strict UTF-8 decoder, decoding from `start` inclusive to `end` exclusive. */
1677
- export function new_utf8_array ( array : arrayref , start : i32 , end : i32 ) : stringref ;
1677
+ export function new_utf8_array ( array : ref_array , start : i32 , end : i32 ) : ref_string ;
1678
1678
/** Creates a new string from memory using a lossy UTF-8 decoder, decoding `bytes` bytes starting at `ptr`. */
1679
- export function new_lossy_utf8 ( ptr : usize , bytes : i32 ) : stringref ;
1679
+ export function new_lossy_utf8 ( ptr : usize , bytes : i32 ) : ref_string ;
1680
1680
/** Creates a new string from `array` using a lossy UTF-8 decoder, decoding from `start` inclusive to `end` exclusive. */
1681
- export function new_lossy_utf8_array ( array : arrayref , start : i32 , end : i32 ) : stringref ;
1681
+ export function new_lossy_utf8_array ( array : ref_array , start : i32 , end : i32 ) : ref_string ;
1682
1682
/** Creates a new string from memory using a strict WTF-8 decoder, decodiing `bytes` bytes starting at `ptr`. */
1683
- export function new_wtf8 ( ptr : usize , bytes : i32 ) : stringref ;
1683
+ export function new_wtf8 ( ptr : usize , bytes : i32 ) : ref_string ;
1684
1684
/** Creates a new string from `array` using a strict WTF-8 decoder, decoding from `start` inclusive to `end` exclusive. */
1685
- export function new_wtf8_array ( array : arrayref , start : i32 , end : i32 ) : stringref ;
1685
+ export function new_wtf8_array ( array : ref_array , start : i32 , end : i32 ) : ref_string ;
1686
1686
/** Creates a new string from memory assuming WTF-16 encoding, reading `codeunits` code units starting at `ptr`. `ptr` must be two-byte aligned. */
1687
- export function new_wtf16 ( ptr : usize , codeunits : i32 ) : stringref ;
1687
+ export function new_wtf16 ( ptr : usize , codeunits : i32 ) : ref_string ;
1688
1688
/** Creates a new string from `array` assuming WTF-16 encoding, reading from `start` inclusive to `end` exclusive. */
1689
- export function new_wtf16_array ( array : arrayref , start : i32 , end : i32 ) : stringref ;
1689
+ export function new_wtf16_array ( array : ref_array , start : i32 , end : i32 ) : ref_string ;
1690
1690
/** Creates a new string from the given `codepoint`. */
1691
- export function from_code_point ( codepoint : i32 ) : stringref ;
1691
+ export function from_code_point ( codepoint : i32 ) : ref_string ;
1692
1692
/** Obtains an implementation-defined 32-bit hash value of `str`. */
1693
- export function hash ( str : stringref ) : i32 ;
1693
+ export function hash ( str : ref_string ) : i32 ;
1694
1694
/** Measures the number of bytes required to encode `str` to UTF-8. Returns `-1` if the string contains an isolated surrogate. */
1695
- export function measure_utf8 ( str : stringref ) : i32 ;
1695
+ export function measure_utf8 ( str : ref_string ) : i32 ;
1696
1696
/** Measures the number of bytes required to encode `str` to WTF-8. */
1697
- export function measure_wtf8 ( str : stringref ) : i32 ;
1697
+ export function measure_wtf8 ( str : ref_string ) : i32 ;
1698
1698
/** Measures the number of 16-bit code units required to encode `str` to WTF-16. */
1699
- export function measure_wtf16 ( str : stringref ) : i32 ;
1699
+ export function measure_wtf16 ( str : ref_string ) : i32 ;
1700
1700
/** Tests whether `str` is a sequence of Unicode scalar values, i.e. does not contain isolated surrogates. */
1701
- export function is_usv_sequence ( str : stringref ) : bool ;
1701
+ export function is_usv_sequence ( str : ref_string ) : bool ;
1702
1702
/** Encodes `str` to memory at `ptr` using a strict UTF-8 encoder. */
1703
- export function encode_utf8 ( str : stringref , ptr : usize ) : i32 ;
1703
+ export function encode_utf8 ( str : ref_string , ptr : usize ) : i32 ;
1704
1704
/** Encodes `str` to `arr` at `start` using a strict UTF-8 encoder. */
1705
- export function encode_utf8_array ( str : stringref , arr : arrayref , start : i32 ) : i32 ;
1705
+ export function encode_utf8_array ( str : ref_string , arr : ref_array , start : i32 ) : i32 ;
1706
1706
// TODO: encode_lossy_utf8
1707
1707
// TODO: encode_lossy_utf8_array
1708
1708
/** Encodes `str` to memory at `ptr` using a WTF-8 encoder. */
1709
- export function encode_wtf8 ( str : stringref , ptr : usize ) : i32 ;
1709
+ export function encode_wtf8 ( str : ref_string , ptr : usize ) : i32 ;
1710
1710
/** Encodes `str` to `arr` at `start` using a WTF-8 encoder. */
1711
- export function encode_wtf8_array ( str : stringref , arr : arrayref , start : i32 ) : i32 ;
1711
+ export function encode_wtf8_array ( str : ref_string , arr : ref_array , start : i32 ) : i32 ;
1712
1712
/** Encodes `str` to memory at `ptr` using a WTF-16 encoder. */
1713
- export function encode_wtf16 ( str : stringref , ptr : usize ) : i32 ;
1713
+ export function encode_wtf16 ( str : ref_string , ptr : usize ) : i32 ;
1714
1714
/** Encodes `str` to `arr` at `start` using a WTF-16 encoder. */
1715
- export function encode_wtf16_array ( str : stringref , arr : arrayref , start : i32 ) : i32 ;
1715
+ export function encode_wtf16_array ( str : ref_string , arr : arrayref , start : i32 ) : i32 ;
1716
1716
/** Concatenates `left` and `right` in this order. Traps if either operand is `null`. */
1717
- export function concat ( left : stringref , right : stringref ) : stringref ;
1717
+ export function concat ( left : ref_string , right : ref_string ) : ref_string ;
1718
1718
/** Tests whether `left` and `right` are equal, including if both are `null`. */
1719
- export function eq ( left : stringref , right : stringref ) : bool ;
1719
+ export function eq ( left : ref_string | null , right : ref_string | null ) : bool ;
1720
1720
/** Compares the contents of `left` and `right`, returning `-1` if `left < right`, `0` if `left == right` or `1` if `left > right`. Traps if either operand is `null`. */
1721
- export function compare ( left : stringref , right : stringref ) : i32 ;
1721
+ export function compare ( left : ref_string , right : ref_string ) : i32 ;
1722
1722
/** Obtains a WTF-8 view on `str`. */
1723
- export function as_wtf8 ( str : stringref ) : stringview_wtf8 ;
1723
+ export function as_wtf8 ( str : ref_string ) : ref_stringview_wtf8 ;
1724
1724
/** Obtains a WTF-16 view on `str`. */
1725
- export function as_wtf16 ( str : stringref ) : stringview_wtf16 ;
1725
+ export function as_wtf16 ( str : ref_string ) : ref_stringview_wtf16 ;
1726
1726
/** Obtains an iterator view on `str`. */
1727
- export function as_iter ( str : stringref ) : stringview_iter ;
1727
+ export function as_iter ( str : ref_string ) : ref_stringview_iter ;
1728
1728
}
1729
1729
1730
1730
declare namespace stringview_wtf8 {
1731
1731
/** Obtains the highest code point offset in `view` that is not greater than `pos + bytes`. If `pos` does not match the start of a code point, it is advanced to the next code point. */
1732
- export function advance ( view : stringview_wtf8 , pos : i32 , bytes : i32 ) : i32 ;
1732
+ export function advance ( view : ref_stringview_wtf8 , pos : i32 , bytes : i32 ) : i32 ;
1733
1733
/** Returns a substring of `view` from `start` inclusive to `end` exclusive. If `start` or `end` do not match the start of a code point, these are advanced to the next code point. */
1734
- export function slice ( view : stringview_wtf8 , start : i32 , end : i32 ) : stringref ;
1734
+ export function slice ( view : ref_stringview_wtf8 , start : i32 , end : i32 ) : ref_string ;
1735
1735
// TODO: encode_utf8
1736
1736
// TODO: encode_lossy_utf8
1737
1737
// TODO: encode_wtf8
1738
1738
}
1739
1739
1740
1740
declare namespace stringview_wtf16 {
1741
1741
/** Obtains the number of 16-bit code units in `view`. */
1742
- export function length ( view : stringview_wtf16 ) : i32 ;
1742
+ export function length ( view : ref_stringview_wtf16 ) : i32 ;
1743
1743
/** Returns a substring of `view` from `start` inclusive to `end` exclusive. */
1744
- export function slice ( view : stringview_wtf16 , start : i32 , end : i32 ) : stringref ;
1744
+ export function slice ( view : ref_stringview_wtf16 , start : i32 , end : i32 ) : ref_string ;
1745
1745
/** Obtains the 16-bit code unit at `pos` in `view`. Traps if `pos` is greater than or equal to the view's WTF-16 length. */
1746
- export function get_codeunit ( view : stringview_wtf16 , pos : i32 ) : i32 ;
1746
+ export function get_codeunit ( view : ref_stringview_wtf16 , pos : i32 ) : i32 ;
1747
1747
// TODO: encode
1748
1748
}
1749
1749
1750
1750
declare namespace stringview_iter {
1751
1751
/** Obtains the code point at the iterator's current position, advancing the iterator by one code point. Returns `-1` if already at the end. */
1752
- export function next ( view : stringview_iter ) : i32 ;
1752
+ export function next ( view : ref_stringview_iter ) : i32 ;
1753
1753
/** Advances the iterator by up to `count` code points, returning the number of code points consumed. */
1754
- export function advance ( view : stringview_iter , count : i32 ) : i32 ;
1754
+ export function advance ( view : ref_stringview_iter , count : i32 ) : i32 ;
1755
1755
/** Rewinds the iterator by up to `count` code points, returning the number of coode points consumed. */
1756
- export function rewind ( view : stringview_iter , count : i32 ) : i32 ;
1756
+ export function rewind ( view : ref_stringview_iter , count : i32 ) : i32 ;
1757
1757
/** Returns a substring of `view`, starting at the current position for up to `count` code points. */
1758
- export function slice ( view : stringview_iter , count : i32 ) : stringref ;
1758
+ export function slice ( view : ref_stringview_iter , count : i32 ) : ref_string ;
1759
1759
}
1760
1760
1761
1761
/** Macro type evaluating to the underlying native WebAssembly type. */
0 commit comments