Giter Site home page Giter Site logo

usb-disk-probe's Introduction

usb-disk-probe

Crates.io

Provides a stream type which can be used to probe for USB storage devices in the system.

Example

use usb_disk_probe::stream::UsbDiskProbe;

use futures::stream::StreamExt;

fn main() {
    futures::executor::block_on(async move {
        let mut stream = UsbDiskProbe::new().await.unwrap();
        while let Some(device_result) = stream.next().await {
            let device = device_result.unwrap();
            println!("{}", device.display());
        }
    });
}

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.

usb-disk-probe's People

Contributors

mmstick avatar

Stargazers

sprhawk avatar Christoph Grabo avatar Rust avatar  avatar  avatar Juri Hahn avatar

Watchers

James Cloos avatar Carl Richell avatar  avatar Jeremy Soller avatar  avatar

usb-disk-probe's Issues

[Bug] test failure on debian

I'm in the process of packaging this crate for debian. It compiles fine, but the tests fail:


running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests usb-disk-probe
     Running `rustdoc --edition=2018 --crate-type lib --crate-name usb_disk_probe --test /<<PKGBUILDDIR>>/src/lib.rs -L dependency=/<<PKGBUILDDIR>>/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/<<PKGBUILDDIR>>/target/debug/deps --extern async_std=/<<PKGBUILDDIR>>/target/x86_64-unknown-linux-gnu/debug/deps/libasync_std-908a3a12389b5cc2.rlib --extern futures=/<<PKGBUILDDIR>>/target/x86_64-unknown-linux-gnu/debug/deps/libfutures-c69f20b72e1ebb3a.rlib --extern thiserror=/<<PKGBUILDDIR>>/target/x86_64-unknown-linux-gnu/debug/deps/libthiserror-1aae4e5d7abcfc04.rlib --extern usb_disk_probe=/<<PKGBUILDDIR>>/target/x86_64-unknown-linux-gnu/debug/deps/libusb_disk_probe-d0a230397d6c474c.rlib -C embed-bitcode=no --error-format human`

running 1 test
test src/stream.rs - stream::UsbDiskProbe (line 27) ... FAILED

failures:

---- src/stream.rs - stream::UsbDiskProbe (line 27) stdout ----
Test executable failed (exit status: 101).

stderr:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Open(Custom { kind: NotFound, error: VerboseError { source: Os { code: 2, kind: NotFound, message: "No such file or directory" }, message: "could not read directory `/dev/disk/by-path/`" } })', src/stream.rs:9:52
stack backtrace:
   0: rust_begin_unwind
             at /usr/src/rustc-1.62.1/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /usr/src/rustc-1.62.1/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /usr/src/rustc-1.62.1/library/core/src/result.rs:1785:5
   3: core::result::Result<T,E>::unwrap
   4: rust_out::main::{{closure}}
   5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   6: futures_executor::local_pool::block_on::{{closure}}
   7: futures_executor::local_pool::run_executor::{{closure}}
   8: std::thread::local::LocalKey<T>::try_with
   9: std::thread::local::LocalKey<T>::with
  10: futures_executor::local_pool::run_executor
  11: futures_executor::local_pool::block_on
  12: rust_out::main
  13: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.



failures:
    src/stream.rs - stream::UsbDiskProbe (line 27)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.11s

Could you maybe shed some light on this? I'd appreciate it.

Cheers

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.