hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

classes.ha (1211B)


      1 // SPDX-License-Identifier: MPL-2.0
      2 // (c) Hare authors <https://harelang.org>
      3 
      4 // A tagged union of all signed integer types.
      5 export type signed = (i8 | i16 | i32 | i64 | int);
      6 
      7 // A tagged union of all unsigned integer types, excluding uintptr.
      8 export type unsigned = (u8 | u16 | u32 | u64 | uint | size);
      9 
     10 // A tagged union of all integer types.
     11 export type integer = (...signed | ...unsigned);
     12 
     13 // A tagged union of all floating point numeric types.
     14 export type floating = (f32 | f64);
     15 
     16 // A tagged union of all numeric types.
     17 export type numeric = (...integer | ...floating);
     18 
     19 // A type representing the internal structure of strings, useful for low-level
     20 // string manipulation.
     21 export type string = struct {
     22 	// UTF-8 encoded octets.
     23 	data: nullable *[*]u8,
     24 
     25 	// The length capacity, in octets of UTF-8 data.
     26 	length: size,
     27 
     28 	// The allocated capacity, in octets of UTF-8 data.
     29 	capacity: size,
     30 };
     31 
     32 // A type representing the internal structure of slices, useful for low-level
     33 // slice manipulation.
     34 export type slice = struct {
     35 	// The slice contents.
     36 	data: nullable *opaque,
     37 
     38 	// The number of members of the slice.
     39 	length: size,
     40 
     41 	// The allocated capacity (in members) of data.
     42 	capacity: size,
     43 };