> ## 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.

# Lookup

> Lookup — Kinetica Rust API

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

<pre>`pub struct Lookup<'a, 'k, R = GenericRecord> { /* private fields */ }`</pre>

The records one lookup matches, read from the server a page at a time in a single pass; made by [`RecordRetriever::lookup`](https://docs.kinetica.com/content/api/rust/record_retriever/struct.RecordRetriever#method.lookup).On a replicated table every page is taken from one worker rank, drawn at random with the first page: each rank holds the whole table in an order of its own, so a page from another rank could repeat or skip records. If the cluster or the shard mapping changes during the pass (the rank leaving the cluster, a fail-over, a new shard mapping), the lookup fails rather than go on from another rank. A lookup routed by key, or through the head node, reads each page as [`RecordRetriever::get_by_key_with_offset`](https://docs.kinetica.com/content/api/rust/record_retriever/struct.RecordRetriever#method.get_by_key_with_offset) does, recovering as it does.[`size`](https://docs.kinetica.com/content/api/rust/record_retriever/struct.Lookup#method.size) is the number of records the lookup matches, known once its first page has been read; asking for it reads that page.

## Implementations

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_retriever.rs#L1598-L1686)
impl\<R: [RetrievedRecord](https://docs.kinetica.com/content/api/rust/record_retriever/trait.RetrievedRecord.md)> [Lookup](https://docs.kinetica.com/content/api/rust/record_retriever/struct.Lookup.md)\<'\_, '\_, R>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_retriever.rs#L1605-L1610)
pub async fn [size](#method.size)(\&mut self) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[i64](https://doc.rust-lang.org/1.98.1/std/primitive.i64.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

How many records the lookup matches in all; reads the first page if none has been read.

##### Errors

Fails if the page cannot be read.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/record_retriever.rs#L1619-L1624)
pub async fn [next](#method.next)(\&mut self) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<R>, [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

The next record, reading the next page once the last is used up, or `None` after the last record.

##### Errors

Fails if a page cannot be read, or if the lookup is on a replicated table and the cluster or shard mapping changed during it.


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