12 stable releases
new 3.0.1 | May 12, 2025 |
---|---|
3.0.0 | May 11, 2025 |
2.0.0 | May 10, 2025 |
1.1.0 | May 10, 2025 |
#522 in Text processing
1,560 downloads per month
Used in drova_plugins
9KB
156 lines
Usage
Install
cargo add drova_sdk
Example
use dalet::types::{Page};
use drova_sdk::requester::{Error, InputHandler, RequesterBuilder};
use async_trait::async_trait;
use drova_sdk::requester::{Error, ProtocolHandler, Response};
pub struct HttpProtocol;
#[async_trait]
impl ProtocolHandler for HttpProtocol {
async fn fetch(&self, url: &url::Url) -> Result<Response, Error> {
todo!()
}
}
pub struct TextInput;
impl InputHandler for TextInput {
fn process_text(&self, data: String, _: Option<&url::Url>) -> Result<Page, Error> {
todo!()
}
fn process_bytes(&self, _: Vec<u8>, _: Option<&url::Url>) -> Result<Page, Error> {
todo!()
}
}
fn main() {
let requester = RequesterBuilder::default()
.protocol("http", &HttpProtocol)
.protocol("https", &HttpProtocol)
.input("text/plain", &TextInput)
.input("text/*", &TextInput)
.build();
println!("{:#?}", requester.process("http://example.com"))
}
Dependencies
~3–4.5MB
~75K SLoC