unwrap infaillible
This commit is contained in:
parent
b00ce70504
commit
ae6e2edafa
2 changed files with 5 additions and 2 deletions
|
@ -14,3 +14,4 @@ keywords.workspace = true
|
|||
anyhow = "1.0.97"
|
||||
bingus = { path = "../bingus" }
|
||||
clap = { version = "4.5.32", features = ["derive"] }
|
||||
unwrap-infallible = "0.1.5"
|
||||
|
|
|
@ -3,11 +3,12 @@ use std::fs::File;
|
|||
use anyhow::{anyhow, Context, Error};
|
||||
use bingus::{
|
||||
doc::printpdf::PdfDocument,
|
||||
img::{Dimensions, GrayImage, RgbImage},
|
||||
img::{Dimensions, GrayImage},
|
||||
Bendable, Bytes,
|
||||
};
|
||||
use clap::Parser;
|
||||
use cli::Cli;
|
||||
use unwrap_infallible::UnwrapInfallible;
|
||||
|
||||
mod cli;
|
||||
|
||||
|
@ -17,7 +18,8 @@ fn main() -> Result<(), Error> {
|
|||
.context("opening file")?
|
||||
.bend_into::<PdfDocument>((), Default::default())
|
||||
.map_err(|e| anyhow!("parsing PDF: {e}"))?
|
||||
.bend_into::<Bytes>((), Default::default())?;
|
||||
.bend_into::<Bytes>((), Default::default())
|
||||
.unwrap_infallible();
|
||||
let dimensions = {
|
||||
let c = bytes.len().isqrt().try_into().context("image too big")?;
|
||||
Dimensions {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue