(col_val: &Col::ColType)
| 432 | |
| 433 | #[inline] |
| 434 | fn find<Tbl: Table, Col: Index + Column<Table = Tbl>>(col_val: &Col::ColType) -> Option<Tbl::Row> { |
| 435 | // Find the row with a match. |
| 436 | let index_id = Col::index_id(); |
| 437 | let point = IterBuf::serialize(col_val).unwrap(); |
| 438 | |
| 439 | let iter = datastore_index_scan_point_bsatn(index_id, &point); |
| 440 | let mut iter = TableIter::new_with_buf(iter, point); |
| 441 | |
| 442 | // We will always find either 0 or 1 rows here due to the unique constraint. |
| 443 | let row = iter.next(); |
| 444 | assert!( |
| 445 | iter.is_exhausted(), |
| 446 | "`datastore_index_scan_point_bsatn` on unique field cannot return >1 rows" |
| 447 | ); |
| 448 | row |
| 449 | } |
| 450 | |
| 451 | /// See `sys::datastore_index_scan_point_bsatn`. |
| 452 | /// Panics when the aforementioned errors. |
no test coverage detected
searching dependent graphs…