Expand description
Fixed-capacity ASCII strings for high-performance systems.
This crate provides stack-allocated, fixed-capacity ASCII string types optimized for trading systems and other latency-sensitive applications.
§no_std Support
This crate is no_std compatible by default. Enable the std feature
for Error trait implementations.
§Design Principles
- Immutable: Strings are immutable after creation. Hash is computed once.
- Copy: All string types are
Copy. Use newtypes for move semantics. - Performance: Single 64-bit comparison for equality fast path.
- Full ASCII: Supports 0x01-0x7F (null is structural, not content). Use
AsciiTextfor printable-only.
§Example
use nexus_ascii::{AsciiString, AsciiError};
// Construction
let s: AsciiString<32> = AsciiString::try_from("BTC-USD")?;
// Equality is fast (header comparison first)
let s2: AsciiString<32> = AsciiString::try_from("BTC-USD")?;
assert_eq!(s, s2);
// Access underlying data
assert_eq!(s.as_str(), "BTC-USD");
assert_eq!(s.len(), 7);Modules§
Structs§
- Ascii
Char - A single ASCII character (0x00-0x7F).
- Ascii
Str - A borrowed slice of validated ASCII bytes.
- Ascii
String - A fixed-capacity, immutable ASCII string.
- Ascii
String Builder - A mutable builder for constructing
AsciiStringvalues. - Ascii
Text - A fixed-capacity ASCII string containing only printable characters.
- Ascii
Text Str - A borrowed slice of validated printable ASCII bytes.
- Flat
Ascii String - A fixed-capacity, null-terminated ASCII byte buffer.
- Flat
Ascii Text - A fixed-capacity flat ASCII buffer containing only printable characters.
- Integer
TooLarge - Error returned when an integer is too large to fit in the target capacity.
- Invalid
Ascii Char - Error when creating an
AsciiCharfrom an invalid value.
Enums§
- Ascii
Error - Errors that can occur when constructing ASCII types.
Type Aliases§
- Ascii
String8 - 8-byte capacity ASCII string.
- Ascii
String16 - 16-byte capacity ASCII string.
- Ascii
String32 - 32-byte capacity ASCII string.
- Ascii
String64 - 64-byte capacity ASCII string.
- Ascii
String128 - 128-byte capacity ASCII string.
- Ascii
String256 - 256-byte capacity ASCII string.
- Ascii
String Builder8 - 8-byte capacity ASCII string builder.
- Ascii
String Builder16 - 16-byte capacity ASCII string builder.
- Ascii
String Builder32 - 32-byte capacity ASCII string builder.
- Ascii
String Builder64 - 64-byte capacity ASCII string builder.
- Ascii
String Builder128 - 128-byte capacity ASCII string builder.
- Ascii
Text8 - 8-byte capacity printable ASCII text.
- Ascii
Text16 - 16-byte capacity printable ASCII text.
- Ascii
Text32 - 32-byte capacity printable ASCII text.
- Ascii
Text64 - 64-byte capacity printable ASCII text.
- Ascii
Text128 - 128-byte capacity printable ASCII text.
- Flat
Ascii String8 - 8-byte capacity flat ASCII string.
- Flat
Ascii String16 - 16-byte capacity flat ASCII string.
- Flat
Ascii String32 - 32-byte capacity flat ASCII string.
- Flat
Ascii String64 - 64-byte capacity flat ASCII string.
- Flat
Ascii String128 - 128-byte capacity flat ASCII string.
- Flat
Ascii String256 - 256-byte capacity flat ASCII string.
- Flat
Ascii Text8 - 8-byte capacity flat printable ASCII text.
- Flat
Ascii Text16 - 16-byte capacity flat printable ASCII text.
- Flat
Ascii Text32 - 32-byte capacity flat printable ASCII text.
- Flat
Ascii Text64 - 64-byte capacity flat printable ASCII text.
- Flat
Ascii Text128 - 128-byte capacity flat printable ASCII text.