> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RecordKey

> RecordKey — Kinetica Rust API

[gpudb\_api](https://docs.kinetica.com/content/api/rust/index.md)::<wbr />[record\_key](https://docs.kinetica.com/content/api/rust/record_key/index.md)
[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L118-L137)&#x20;

<pre>`pub struct RecordKey { /* private fields */ }`</pre>
Implementations

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L139-L519)
impl [RecordKey](https://docs.kinetica.com/content/api/rust/record_key/struct.RecordKey.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L140-L147)
pub fn [new](#method.new)(size: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)) -> Self

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L150-L152)
pub fn [bytes](#method.bytes)(\&self) -> &\[[u8](https://doc.rust-lang.org/1.98.1/std/primitive.u8.html)]&#x20;

The encoded key bytes.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L156-L158)
pub fn [routing\_hash](#method.routing_hash)(\&self) -> [u64](https://doc.rust-lang.org/1.98.1/std/primitive.u64.html)

The hash that selects the shard, valid once [`RecordKey::compute_hashes`](https://docs.kinetica.com/content/api/rust/record_key/struct.RecordKey#method.compute_hashes) has run.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L161-L163)
pub fn [is\_valid](#method.is_valid)(\&self) -> [bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html)

Whether every value encoded into this key was usable.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L191-L196)
pub fn [route](#method.route)(\&self, routing\_table: &\[[i32](https://doc.rust-lang.org/1.98.1/std/primitive.i32.html)]) -> [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L198-L202)
pub fn [compute\_hashes](#method.compute_hashes)(\&mut self)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L204)
pub fn [push\_i32](#method.push_i32)(\&mut self, v: [i32](https://doc.rust-lang.org/1.98.1/std/primitive.i32.html))

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L205)
pub fn [push\_i64](#method.push_i64)(\&mut self, v: [i64](https://doc.rust-lang.org/1.98.1/std/primitive.i64.html))

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L207-L209)
pub fn [push\_f32](#method.push_f32)(\&mut self, v: [f32](https://doc.rust-lang.org/1.98.1/std/primitive.f32.html))

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L211-L213)
pub fn [push\_f64](#method.push_f64)(\&mut self, v: [f64](https://doc.rust-lang.org/1.98.1/std/primitive.f64.html))

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L217-L219)
pub fn [push\_null](#method.push_null)(\&mut self, width: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html))

Appends a null value of a type whose encoding is `width` bytes wide: that many zero bytes.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L222-L224)
pub fn [push\_bool](#method.push_bool)(\&mut self, v: [bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html))

Appends a boolean value (1 byte: 1 for true, 0 for false).

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L227-L229)
pub fn [push\_i8](#method.push_i8)(\&mut self, v: [i8](https://doc.rust-lang.org/1.98.1/std/primitive.i8.html))

Appends an 8-bit signed integer (1 byte).

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L232-L234)
pub fn [push\_i16](#method.push_i16)(\&mut self, v: [i16](https://doc.rust-lang.org/1.98.1/std/primitive.i16.html))

Appends a 16-bit signed integer (2 bytes, little-endian).

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L236-L241)
pub fn [push\_char](#method.push_char)(\&mut self, val: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), length: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html))

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L243-L246)
pub fn [push\_string](#method.push_string)(\&mut self, val: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html))

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L248-L279)
pub fn [push\_date](#method.push_date)(\&mut self, val: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html))

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L293-L341)
pub fn [push\_timestamp](#method.push_timestamp)(\&mut self, millis: [i64](https://doc.rust-lang.org/1.98.1/std/primitive.i64.html))

Appends a timestamp value (milliseconds since Unix epoch) as 8 bytes packed datetime.Encoding (64 bits):

<ul>
  <li>Bits 53-63: year-1900 (11 bits)</li>
  <li>Bits 49-52: month (4 bits)</li>
  <li>Bits 44-48: day (5 bits)</li>
  <li>Bits 39-43: hour (5 bits)</li>
  <li>Bits 33-38: minute (6 bits)</li>
  <li>Bits 27-32: second (6 bits)</li>
  <li>Bits 17-26: millisecond (10 bits)</li>
  <li>Bits 8-16: day of year (9 bits)</li>
  <li>Bits 5-7: day of week (3 bits)</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L344-L391)
pub fn [push\_datetime](#method.push_datetime)(\&mut self, val: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html))

Appends a datetime value from string format “YYYY-MM-DD HH:MM:SS.mmm”

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L400-L418)
pub fn [push\_time](#method.push_time)(\&mut self, val: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html))

Appends a time value from string format “HH:MM:SS.mmm”Encoding (32 bits):

<ul>
  <li>Bits 26-31: hour (6 bits)</li>
  <li>Bits 20-25: minute (6 bits)</li>
  <li>Bits 14-19: second (6 bits)</li>
  <li>Bits 4-13: millisecond (10 bits)</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L429-L458)
pub fn [push\_uuid](#method.push_uuid)(\&mut self, val: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html))

Appends a UUID value from string format “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”Encoding (16 bytes) - special little-endian packing:

<ul>
  <li>Bytes 0-3: Last 8 hex digits of last group (reversed)</li>
  <li>Bytes 4-5: First 4 hex digits of last group (reversed)</li>
  <li>Bytes 6-7: Fourth group (reversed)</li>
  <li>Bytes 8-9: Third group (reversed)</li>
  <li>Bytes 10-11: Second group (reversed)</li>
  <li>Bytes 12-15: First group (reversed)</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L471-L482)
pub fn [push\_ulong](#method.push_ulong)(\&mut self, val: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html)) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[()](https://doc.rust-lang.org/1.98.1/std/primitive.unit.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Appends an unsigned long given as text: the value’s low 64 bits, little-endian like every other number in the key.The text must be one to twenty digits, or this writes nothing and fails. That check is of the form, not the range, so a twenty-digit value above `u64::MAX` passes and keeps only its low 64 bits.Only ASCII digits are accepted, as for a look-up filter (see `RecordKeyBuilder::build_expression`). The server refuses other digits too (“invalid ulong”), so such a record fails either way; here it fails before it is sent.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L484-L500)
pub fn [push\_ipv4](#method.push_ipv4)(\&mut self, val: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html))

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L507-L518)
pub fn [push\_decimal](#method.push_decimal)(\&mut self, val: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), precision: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html), scale: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html))

Appends a decimal value given as text: the text is parsed as an exact decimal and rounded HALF\_UP to `scale`, and text that is not a number, or is wider than `precision` at that scale, encodes as zero. A precision of up to 18 takes 8 bytes and a wider one 12, both two’s complement.

## Trait Implementations

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L117)
impl [Debug](https://doc.rust-lang.org/1.98.1/core/fmt/trait.Debug.html) for [RecordKey](https://docs.kinetica.com/content/api/rust/record_key/struct.RecordKey.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_key.rs#L117)
fn [fmt](https://doc.rust-lang.org/1.98.1/core/fmt/trait.Debug.html#tymethod.fmt)(\&self, f: \&mut [Formatter](https://doc.rust-lang.org/1.98.1/core/fmt/struct.Formatter.html)\<'\_>) -> [Result](https://doc.rust-lang.org/1.98.1/core/fmt/type.Result.html)

Formats the value using the given formatter. [Read more](https://doc.rust-lang.org/1.98.1/core/fmt/trait.Debug.html#tymethod.fmt)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.