Skip to main content
pub enum ShardKeyValue<‘a> 
Int(i32),
    Long(i64),
    Float(f32),
    Double(f64),
    String(&‘a str),
    Date(&‘a str),
    Ipv4(&‘a str),
    Decimal(&‘a str),
    Boolean(bool),
    Int8(i8),
    Int16(i16),
    Timestamp(i64),
    DateTime(&‘a str),
    Time(&‘a str),
    Uuid(&‘a str),
    Ulong(&‘a str),
    Null,

Typed shard key value to avoid string parsing overhead.

Use typed variants when possible for better performance. String variants are provided for complex types that require parsing.

Performance Notes

  • Numeric types (Int, Long, Float, Double, Boolean, Int8, Int16) are Copy and zero-cost
  • String references (String, Date, Ipv4, Decimal, etc.) are borrowed - no allocation
  • All variants are Copy for zero-cost passing

Variants

Int(i32)

32-bit integer value

Long(i64)

64-bit integer value

Float(f32)

32-bit float value

Double(f64)

64-bit double value

String(&‘a str)

String value (also used for char(N) types) - borrowed reference

Date(&‘a str)

Date in YYYY-MM-DD format - borrowed reference

Ipv4(&‘a str)

IPv4 in dotted-quad format (e.g., “192.168.1.100”) - borrowed reference

Decimal(&‘a str)

Decimal as string (e.g., “12345.6789”) - borrowed reference

Boolean(bool)

Boolean value (true/false)

Int8(i8)

8-bit signed integer (-128 to 127)

Int16(i16)

16-bit signed integer (-32768 to 32767)

Timestamp(i64)

Timestamp as milliseconds since Unix epoch

DateTime(&‘a str)

DateTime in YYYY-MM-DD HH:MM:SS.mmm format - borrowed reference

Time(&‘a str)

Time in HH:MM:SS.mmm format - borrowed reference

Uuid(&‘a str)

UUID in standard format (e.g., “550e8400-e29b-41d4-a716-446655440000”) - borrowed reference

Ulong(&‘a str)

Unsigned long as string (0 to 18446744073709551615) - borrowed reference

Null

A null value, for a column of any type. It encodes as zero bytes in the width of the column’s encoding.

Trait Implementations

Source

impl<‘a> Clone for ShardKeyValue<‘a>

Source

fn clone(&self) -> ShardKeyValue<‘a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source

impl<‘a> Copy for ShardKeyValue<‘a>

Source

impl<‘a> Debug for ShardKeyValue<‘a>

Source

fn fmt(&self, f: &mut Formatter<’_>) -> Result

Formats the value using the given formatter. Read more