Skip to content

Commit

Permalink
Run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
robertknight committed Aug 30, 2024
1 parent bcb6550 commit b8b8322
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions ocrs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pub use text_items::{TextChar, TextItem, TextLine, TextWord};
// nb. The "E" before "ABCDE" should be the EUR symbol.
const DEFAULT_ALPHABET: &str = " 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~EABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";


/// Configuration for an [OcrEngine] instance.
#[derive(Default)]
pub struct OcrEngineParams {
Expand Down Expand Up @@ -87,7 +86,9 @@ impl OcrEngine {
recognizer,
debug: params.debug,
decode_method: params.decode_method,
alphabet: params.alphabet.unwrap_or_else(|| DEFAULT_ALPHABET.to_string()),
alphabet: params
.alphabet
.unwrap_or_else(|| DEFAULT_ALPHABET.to_string()),
})
}

Expand Down
8 changes: 6 additions & 2 deletions ocrs/src/recognition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,10 @@ struct LineRecResult {
/// for each line.
///
/// Entries in the result may be `None` if no text was recognized for a line.
fn text_lines_from_recognition_results(results: &[LineRecResult], alphabet: &str) -> Vec<Option<TextLine>> {
fn text_lines_from_recognition_results(
results: &[LineRecResult],
alphabet: &str,
) -> Vec<Option<TextLine>> {
results
.iter()
.map(|result| {
Expand Down Expand Up @@ -298,7 +301,8 @@ fn text_lines_from_recognition_results(results: &[LineRecResult], alphabet: &str
result.line.region.borrow(),
start_x,
end_x,
).expect("invalid X coords"),
)
.expect("invalid X coords"),
})
})
.collect();
Expand Down

0 comments on commit b8b8322

Please sign in to comment.