lychee/examples/extract/extract.rs
Matthias 47df7780fe
Use captured identifiers in format strings (#507)
Makes for arguably cleaner-looking code.
The downside is that the MSRV is 1.58
https://blog.rust-lang.org/2022/01/13/Rust-1.58.0.html

Given that nobody uses lychee as a library yet
and we have precompiled binaries, it's an acceptable
tradeoff.
My little research revealed that this is a much-liked
feature: https://twitter.com/matthiasendler/status/1483895557621960715
2022-02-12 10:51:52 +01:00

13 lines
361 B
Rust

use lychee_lib::extract::Extractor;
use lychee_lib::Result;
use lychee_lib::{FileType, InputContent};
use std::fs;
#[tokio::main]
async fn main() -> Result<()> {
let input = fs::read_to_string("fixtures/elvis.html").unwrap();
let links = Extractor::extract(&InputContent::from_string(&input, FileType::Html));
println!("{links:#?}");
Ok(())
}