Skip to main content

Symbol

Trait Symbol 

Source
pub unsafe trait Symbol:
    Ord
    + Copy
    + Send
    + Sync
    + 'static { }
Expand description

A symbol type for suffix-array construction. All stdlib unsigned and signed integer types satisfy this, as does [T; N] for any T: Symbol (arrays have no padding and inherit Ord lexicographically from T). To use a custom type as a symbol, implement this trait yourself; if the type contains padding, mark it #[repr(C, packed)] first.

The trait bundles every other bound the algorithm needs from a symbol type (Ord + Copy + Send + Sync + 'static), so the public API surface only ever needs S: Symbol.

§Safety

Implementations must guarantee that bit-equality of the in-memory representation implies value-equality — i.e. no padding bytes, no invalid bit patterns that two distinct values could share. The byte-view SIMD LCP path in LcpDispatch::lcp casts &[S] to a &[u8] view and compares bytes; if two distinct S values could have identical bytes, or one S value could have two different byte representations (e.g. via uninitialised padding), the LCP function would return wrong answers and corrupt the resulting suffix array.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Symbol for i8

Source§

impl Symbol for i16

Source§

impl Symbol for i32

Source§

impl Symbol for i64

Source§

impl Symbol for i128

Source§

impl Symbol for isize

Source§

impl Symbol for u8

Source§

impl Symbol for u16

Source§

impl Symbol for u32

Source§

impl Symbol for u64

Source§

impl Symbol for u128

Source§

impl Symbol for usize

Source§

impl<T: Symbol, const N: usize> Symbol for [T; N]

Implementors§