19 releases (12 stable)

5.0.3 Feb 1, 2024
5.0.2 Dec 16, 2023
5.0.1 Oct 14, 2023
5.0.0 Jul 30, 2023
0.0.3 Sep 22, 2016

#192 in Web programming

Download history 9/week @ 2023-12-29 16/week @ 2024-01-05 41/week @ 2024-01-12 20/week @ 2024-01-19 62/week @ 2024-01-26 26/week @ 2024-02-02 8/week @ 2024-02-09 68/week @ 2024-02-16 107/week @ 2024-02-23 160/week @ 2024-03-01 104/week @ 2024-03-08 138/week @ 2024-03-15 100/week @ 2024-03-22 112/week @ 2024-03-29 136/week @ 2024-04-05

507 downloads per month
Used in 2 crates

MIT/Apache

120KB
2.5K SLoC

ipp.rs

IPP protocol implementation for Rust. This crate implements IPP protocol as defined in RFC 8010, RFC 8011.

It supports both synchronous and asynchronous operations (requests and responses) which is controlled by the async feature flag.

The following build-time features are supported:

  • async - enables asynchronous APIs
  • async-client - enables asynchronous IPP client based on reqwest crate, implies async feature
  • client - enables blocking IPP client based on ureq crate
  • async-client-tls - enables asynchronous IPP client with TLS
  • client-tls - enables blocking IPP client with TLS

By default, all features are enabled. Use default-features=false dependency option to disable them.

Documentation

Usage example for async client:

use ipp::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let uri: Uri = "http://localhost:631/printers/test-printer".parse()?;
    let operation = IppOperationBuilder::get_printer_attributes(uri.clone()).build();
    let client = AsyncIppClient::new(uri);
    let resp = client.send(operation).await?;
    if resp.header().status_code().is_success() {
        let printer_attrs = resp
            .attributes()
            .groups_of(DelimiterTag::PrinterAttributes)
            .next()
            .unwrap();
        for (_, v) in printer_attrs.attributes() {
            println!("{}: {}", v.name(), v.value());
        }
    }
    Ok(())
}

For more usage examples please check the examples folder.

License

Licensed under MIT or Apache license (LICENSE-MIT or LICENSE-APACHE)

Dependencies

~1–17MB
~215K SLoC