Giter Club home page Giter Club logo

ipp.rs's Introduction

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)

ipp.rs's People

Contributors

ancwrd1 avatar srwalter avatar ggodlewski avatar arogovskyy avatar martin-kolarik avatar

Stargazers

周松 avatar

Forkers

cherryicake

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.