Skip to main content

read_row

Function read_row 

Source
pub fn read_row(text: &str, row: usize) -> Result<RowRead, RowError>
Expand description

One row as typed, read on its own, for a frontend that takes a value a row at a time and says at once which row needs another look. decode reads the whole value; this checks a row the same way. row is the row’s number from 1, for the repair and the error to name.

§Errors

A character outside the alphabet, a row too short or too long to be one, or a row that cannot be repaired.

Two characters the person could not read, typed as ? or U, are recovered:

use rite_model::paper32;

let row = paper32::read_row("E9?Q8S8PU8B", 1).unwrap();
assert_eq!(row.text.as_str(), "E9MQ8S8PH8B");
assert!(row.repair.is_some());