Crates.io | ipp |
lib.rs | ipp |
version | 5.1.0 |
source | src |
created_at | 2016-09-17 20:09:03.825614 |
updated_at | 2024-11-10 11:16:29.78306 |
description | Asynchronous IPP print protocol implementation |
homepage | |
repository | https://github.com/ancwrd1/ipp.rs |
max_upload_size | |
id | 6528 |
size | 126,764 |
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, using native-tls backend. Implies async-client
feature.client-tls
- enables blocking IPP client with TLS, using native-tls backend. Implies client
feature.async-client-rustls
- enables asynchronous IPP client with TLS, using rustls backend. Implies async-client
feature.client-rustls
- enables blocking IPP client with TLS, using rustls backend. Implies client
feature.By default, the following features are enabled: async-client-tls
.
Use default-features=false
dependency option to disable them.
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.
Licensed under MIT or Apache license (LICENSE-MIT or LICENSE-APACHE)