Skip to content

Futures codec for Debian's dpkg diversion file

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

pop-os/deb-diversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deb-diversion

Crates.io

Futures codec for Debian's dpkg diversion file.

Example

Generates equivalent output to dpkg-divert --list.

#[macro_use]
extern crate fomat_macros;

const DIVERSIONS: &str = "/var/lib/dpkg/diversions";

use async_std::fs::File;
use deb_diversion::*;
use futures::{executor, prelude::*};
use futures_codec::FramedRead;
use std::str;

fn main() {
    executor::block_on(async_main());
}

async fn async_main() {
    let file = File::open(DIVERSIONS).await.unwrap();

    let mut frames = FramedRead::new(file, DiversionDecoder::default());

    while let Some(event) = frames.next().await {
        let event = event.unwrap();

        pintln!(
            "diversion of "
            (str::from_utf8(&event.of).unwrap())
            " to "
            (str::from_utf8(&event.to).unwrap())
            " by "
            (str::from_utf8(&event.by).unwrap())
        );
    }
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions

About

Futures codec for Debian's dpkg diversion file

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages