Skip to content
forked from ancwrd1/ipp.rs

IPP protocol implementation for Rust

Notifications You must be signed in to change notification settings

jbruechert/ipp.rs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ipp.rs

github actions crates license license docs.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)

About

IPP protocol implementation for Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.1%
  • Shell 0.9%