char256
WARNING
char256 is not implemented in the current release.
| Property | Value |
|---|---|
| Size | 32 bytes (256 bits) |
| Range | 0 – 2256−1 |
| Coverage | no defined Unicode semantics |
char256 is a 32-byte extended-width character unit with no defined Unicode semantics. Like all Rux character types it is an unsigned, non-nullable value type that holds a single code point or raw code unit, and is type-distinct from both integers and strings. It behaves as an unsigned integer for comparison; reserve it for raw code units, custom symbol tables, or oversized ABI character units, and use the default char for Unicode text.
Literals
A character literal is written with single quotes, but extended types are more often built from a raw integer cast:
let unit: char256 = 'A'; // stored as a 256-bit code unit
let raw = 0x1F600 as char256; // raw value via explicit castThe compiler may warn when a plain integer literal is assigned without an explicit cast, since that is rarely intentional.
Escape Sequences
| Sequence | Character |
|---|---|
\n | Newline (U+000A) |
\r | Carriage return (U+000D) |
\t | Horizontal tab (U+0009) |
\\ | Backslash (U+005C) |
\' | Single quote (U+0027) |
\" | Double quote (U+0022) |
\0 | Null (U+0000) |
\u{XXXXXX} | Unicode scalar value (hex) |
The \u{...} escape takes 1–6 hexadecimal digits (braces mandatory).
Typical Use Cases
- Domain-specific wide symbol spaces
Comparison
Character types are comparable for both equality and ordering. For extended types, ordering follows the plain numeric value of the underlying code unit.
| Operator | Description | Result |
|---|---|---|
== | Equal | bool |
!= | Not equal | bool |
< <= > >= | Numeric ordering | bool |
let a: char256 = 'a';
let b: char256 = 'b';
let eq = a == b; // false
let lt = a < b; // trueConversion
char256 widens implicitly to a wider char type and narrows with a checked as (use as? for null on overflow). Because it has no Unicode semantics, it converts to and from its backing unsigned integer with as, but never implicitly:
let raw = 0x1F600 as char256; // integer → character — explicit
let n = raw as uint256; // character → integer — explicit
let wide: char512 = raw; // widening — implicitChar types have no arithmetic operators; cast to the integer type to compute, then cast back. Unlike the Unicode char types, extended types may hold surrogate values (U+D800–U+DFFF) as raw integers, but these carry no Unicode meaning.