From 9d8b741719446a68214177ea85eb1a47bb0172fd Mon Sep 17 00:00:00 2001 From: Bastian Bloessl Date: Mon, 18 Nov 2024 21:43:48 +0100 Subject: [PATCH] create custom result type --- benches/flowgraph.rs | 7 ++-- crates/macros/src/lib.rs | 8 ++-- examples/adsb/Cargo.toml | 1 + examples/adsb/src/bin/listen_adsb.rs | 2 +- examples/adsb/src/decoder.rs | 4 +- examples/adsb/src/demodulator.rs | 2 +- examples/adsb/src/preamble_detector.rs | 2 +- examples/adsb/src/tracker.rs | 2 +- examples/android-hw/Cargo.toml | 1 + examples/android-hw/src/fft_shift.rs | 5 +-- examples/android-hw/src/lib.rs | 6 +-- examples/android-hw/src/main.rs | 2 +- examples/android/Cargo.toml | 1 + examples/android/src/lib.rs | 7 ++-- examples/android/src/main.rs | 2 +- examples/audio/Cargo.toml | 4 +- examples/audio/play_file.rs | 2 +- examples/audio/play_selectable_tone.rs | 2 +- examples/audio/play_stereo.rs | 2 +- examples/audio/play_tone.rs | 2 +- examples/ctrlport-demo.rs | 2 +- examples/custom-routes/Cargo.toml | 1 + examples/custom-routes/src/main.rs | 9 ++--- examples/cw/Cargo.toml | 1 + examples/cw/src/bin/tx.rs | 6 +-- examples/cw/src/lib.rs | 2 +- examples/debug/Cargo.toml | 3 +- examples/debug/oscillators.rs | 6 +-- examples/debug/panic.rs | 3 +- examples/debug/tag_debug.rs | 4 +- examples/egui/Cargo.toml | 1 + examples/egui/src/bin/combined.rs | 4 +- examples/egui/src/bin/egui.rs | 4 +- examples/egui/src/bin/fg.rs | 3 +- examples/egui/src/channel_sink.rs | 2 +- examples/file-trx/Cargo.toml | 1 + examples/file-trx/rx.rs | 2 +- examples/file-trx/tx.rs | 2 +- examples/files.rs | 5 +-- examples/firdes/Cargo.toml | 1 + examples/firdes/src/main.rs | 6 +-- examples/fm-receiver/Cargo.toml | 1 + examples/fm-receiver/src/main.rs | 3 +- examples/keyfob/Cargo.toml | 1 + examples/keyfob/src/decoder.rs | 2 +- examples/keyfob/src/main.rs | 2 +- examples/logging/Cargo.toml | 1 + examples/logging/logging.rs | 2 +- examples/lora/Cargo.toml | 7 ++-- examples/lora/src/bin/loopback.rs | 4 +- examples/lora/src/bin/rx.rs | 5 +-- examples/lora/src/bin/rx_all_channels_eu.rs | 2 +- examples/lora/src/bin/rx_meshtastic.rs | 2 +- .../src/bin/rx_meshtastic_all_channels.rs | 2 +- examples/lora/src/bin/tx.rs | 2 +- examples/lora/src/bin/tx_meshtastic.rs | 2 +- examples/lora/src/deinterleaver.rs | 2 +- examples/lora/src/fft_demod.rs | 9 ++--- examples/lora/src/frame_sync.rs | 23 ++++++------ examples/lora/src/gray_mapping.rs | 2 +- examples/lora/src/hamming_dec.rs | 2 +- examples/lora/src/header_decoder.rs | 7 ++-- examples/lora/src/stream_adder.rs | 2 +- examples/lora/src/transmitter.rs | 2 +- examples/m17/Cargo.toml | 1 + examples/m17/src/bin/rx.rs | 2 +- examples/m17/src/bin/tx.rs | 2 +- examples/m17/src/decoder_block.rs | 2 +- examples/m17/src/encoder_block.rs | 2 +- examples/m17/src/moving_average.rs | 2 +- examples/m17/src/symbol_sync.rs | 2 +- examples/macros/Cargo.toml | 1 + examples/macros/src/main.rs | 4 +- examples/message-passing.rs | 5 +-- examples/rattlegram/Cargo.toml | 1 + examples/rattlegram/src/bin/rx.rs | 2 +- examples/rattlegram/src/bin/trx.rs | 2 +- examples/rattlegram/src/bin/tx.rs | 4 +- examples/rattlegram/src/decoder.rs | 2 +- examples/rattlegram/src/wasm.rs | 2 +- examples/scheduler.rs | 5 +-- examples/spectrum/Cargo.toml | 1 + examples/spectrum/src/bin/cpu.rs | 2 +- examples/spectrum/src/bin/vulkan.rs | 5 +-- examples/spectrum/src/vulkan.rs | 37 +++++++++---------- examples/spectrum/src/wasm/web.rs | 27 +++++++------- examples/ssb/Cargo.toml | 1 + examples/ssb/receive.rs | 3 +- examples/ssb/transmit.rs | 2 +- examples/vect.rs | 9 ++--- examples/vulkan.rs | 7 ++-- examples/wasm/Cargo.toml | 1 + examples/wasm/src/bin/flowgraph.rs | 2 +- examples/wasm/src/lib.rs | 7 ++-- examples/websocket.rs | 5 +-- examples/wgpu/Cargo.toml | 1 + examples/wgpu/src/lib.rs | 7 ++-- examples/wlan/Cargo.toml | 1 + examples/wlan/src/bin/loopback.rs | 13 +++---- examples/wlan/src/bin/rx.rs | 7 ++-- examples/wlan/src/bin/rx_udp.rs | 7 ++-- examples/wlan/src/bin/tx.rs | 5 +-- examples/wlan/src/decoder.rs | 2 +- examples/wlan/src/encoder.rs | 12 +++--- examples/wlan/src/frame_equalizer.rs | 2 +- examples/wlan/src/mapper.rs | 10 ++--- examples/wlan/src/moving_average.rs | 5 +-- examples/wlan/src/prefix.rs | 2 +- examples/wlan/src/sync_long.rs | 2 +- examples/wlan/src/sync_short.rs | 2 +- examples/wlan/tests/prefix-vs-tags.rs | 2 +- examples/zeromq/Cargo.toml | 1 + examples/zeromq/zmq_receiver.rs | 2 +- examples/zeromq/zmq_sender.rs | 2 +- examples/zigbee/Cargo.toml | 1 + examples/zigbee/src/bin/rx.rs | 2 +- examples/zigbee/src/bin/trx.rs | 5 +-- examples/zigbee/src/bin/tx.rs | 5 +-- examples/zigbee/src/clock_recovery_mm.rs | 2 +- examples/zigbee/src/decoder.rs | 2 +- examples/zigbee/src/iq_delay.rs | 5 +-- examples/zigbee/src/lib.rs | 4 +- examples/zigbee/src/mac.rs | 5 +-- examples/zigbee/src/wasm_worker.rs | 2 +- examples/zynq.rs | 5 +-- perf/buffer_rand/Cargo.toml | 1 + perf/buffer_rand/buffer_rand.rs | 9 ++--- perf/buffer_size/Cargo.toml | 1 + perf/buffer_size/buffer_size.rs | 9 ++--- perf/fir/Cargo.toml | 1 + perf/fir/fir.rs | 9 ++--- perf/fir_latency/Cargo.toml | 1 + perf/fir_latency/fir.rs | 9 ++--- perf/msg/Cargo.toml | 1 + perf/msg/msg.rs | 5 +-- perf/null_rand/Cargo.toml | 1 + perf/null_rand/null_rand.rs | 7 ++-- perf/null_rand_latency/Cargo.toml | 1 + perf/null_rand_latency/null_rand_latency.rs | 7 ++-- perf/vulkan/Cargo.toml | 1 + perf/vulkan/vulkan.rs | 9 ++--- perf/wgpu/Cargo.toml | 1 + perf/wgpu/src/bin/perf.rs | 6 +-- perf/wgpu/src/lib.rs | 7 ++-- perf/zynq/Cargo.toml | 1 + perf/zynq/zynq.rs | 7 ++-- src/blocks/apply.rs | 2 +- src/blocks/applyintoiter.rs | 2 +- src/blocks/applynm.rs | 2 +- src/blocks/audio/audio_sink.rs | 2 +- src/blocks/audio/audio_source.rs | 2 +- src/blocks/audio/file_source.rs | 2 +- src/blocks/audio/wav_sink.rs | 2 +- src/blocks/blob_to_udp.rs | 2 +- src/blocks/channel_sink.rs | 2 +- src/blocks/channel_source.rs | 2 +- src/blocks/combine.rs | 2 +- src/blocks/console_sink.rs | 2 +- src/blocks/copy.rs | 2 +- src/blocks/copy_rand.rs | 2 +- src/blocks/delay.rs | 2 +- src/blocks/fft.rs | 2 +- src/blocks/file_sink.rs | 2 +- src/blocks/file_source.rs | 2 +- src/blocks/filter.rs | 2 +- src/blocks/finite_source.rs | 2 +- src/blocks/fir.rs | 2 +- src/blocks/head.rs | 2 +- src/blocks/iir.rs | 2 +- src/blocks/lttng/null_sink.rs | 2 +- src/blocks/lttng/null_source.rs | 2 +- src/blocks/message_burst.rs | 2 +- src/blocks/message_sink.rs | 2 +- src/blocks/message_source.rs | 2 +- src/blocks/moving_avg.rs | 2 +- src/blocks/null_sink.rs | 2 +- src/blocks/null_source.rs | 2 +- src/blocks/pfb/arb_resampler.rs | 2 +- src/blocks/pfb/channelizer.rs | 2 +- src/blocks/pfb/synthesizer.rs | 2 +- src/blocks/seify/sink.rs | 11 ++++-- src/blocks/seify/source.rs | 4 +- src/blocks/selector.rs | 2 +- src/blocks/signal_source/mod.rs | 2 +- src/blocks/sink.rs | 2 +- src/blocks/source.rs | 2 +- src/blocks/split.rs | 2 +- src/blocks/stream_deinterleaver.rs | 2 +- src/blocks/stream_duplicator.rs | 2 +- src/blocks/tag_debug.rs | 2 +- src/blocks/tcp_sink.rs | 6 +-- src/blocks/tcp_source.rs | 4 +- src/blocks/throttle.rs | 2 +- src/blocks/udp_source.rs | 4 +- src/blocks/vector_sink.rs | 2 +- src/blocks/vector_source.rs | 2 +- src/blocks/vulkan.rs | 4 +- src/blocks/wasm/hack_rf.rs | 2 +- src/blocks/wasm/wasm_ws_sink.rs | 2 +- src/blocks/websocket_pmt_sink.rs | 13 +++++-- src/blocks/websocket_sink.rs | 13 +++++-- src/blocks/wgpu.rs | 2 +- src/blocks/xlating_fir.rs | 2 +- src/blocks/zeromq/pub_sink.rs | 2 +- src/blocks/zeromq/sub_source.rs | 2 +- src/blocks/zynq.rs | 2 +- src/blocks/zynq_sync.rs | 2 +- src/lib.rs | 5 +-- src/runtime/block.rs | 9 +++-- src/runtime/message_io.rs | 2 +- src/runtime/mod.rs | 14 ++++--- tests/apply.rs | 2 +- tests/applyintoiter.rs | 2 +- tests/bad_block.rs | 4 +- tests/channel_source.rs | 4 +- tests/combine.rs | 2 +- tests/connect_error.rs | 2 +- tests/fail.rs | 4 +- tests/filter.rs | 2 +- tests/finite_source.rs | 2 +- tests/fir.rs | 2 +- tests/flow.rs | 2 +- tests/mocker.rs | 2 +- tests/runtime.rs | 5 +-- tests/seify.rs | 2 +- tests/slab.rs | 5 +-- tests/source.rs | 2 +- tests/split.rs | 2 +- tests/tag.rs | 2 +- tests/tpb.rs | 2 +- tests/vulkan.rs | 7 ++-- 231 files changed, 417 insertions(+), 421 deletions(-) diff --git a/benches/flowgraph.rs b/benches/flowgraph.rs index 4dbdf4955..120cfa1f7 100644 --- a/benches/flowgraph.rs +++ b/benches/flowgraph.rs @@ -1,17 +1,16 @@ +use anyhow::Result; use criterion::black_box; use criterion::criterion_group; use criterion::criterion_main; use criterion::Criterion; -use std::time::Duration; -use std::time::Instant; - -use futuresdr::anyhow::Result; use futuresdr::blocks::Copy; use futuresdr::blocks::Head; use futuresdr::blocks::NullSource; use futuresdr::blocks::VectorSinkBuilder; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::time::Duration; +use std::time::Instant; fn run_fg(n_samp: u64) -> Result<()> { let mut fg = Flowgraph::new(); diff --git a/crates/macros/src/lib.rs b/crates/macros/src/lib.rs index fcb0496e8..db5f8e943 100644 --- a/crates/macros/src/lib.rs +++ b/crates/macros/src/lib.rs @@ -558,7 +558,7 @@ pub fn message_handler( #mio: &'a mut MessageIo, #meta: &'a mut BlockMeta, #pmt: Pmt, - ) -> std::pin::Pin> + Send + 'a>> { + ) -> std::pin::Pin> + Send + 'a>> { use crate::futures::FutureExt; Box::pin(async move { #(#body)* @@ -571,7 +571,7 @@ pub fn message_handler( #mio: &'a mut MessageIo, #meta: &'a mut BlockMeta, #pmt: Pmt, - ) -> std::pin::Pin> + 'a>> { + ) -> std::pin::Pin> + 'a>> { use crate::futures::FutureExt; Box::pin(async move { #(#body)* @@ -648,7 +648,7 @@ pub fn message_handler_external( #mio: &'a mut MessageIo, #meta: &'a mut BlockMeta, #pmt: Pmt, - ) -> std::pin::Pin> + Send + 'a>> { + ) -> std::pin::Pin> + Send + 'a>> { use futuresdr::futures::FutureExt; Box::pin(async move { #(#body)* @@ -661,7 +661,7 @@ pub fn message_handler_external( #mio: &'a mut MessageIo, #meta: &'a mut BlockMeta, #pmt: Pmt, - ) -> std::pin::Pin> + 'a>> { + ) -> std::pin::Pin> + 'a>> { use futuresdr::futures::FutureExt; Box::pin(async move { #(#body)* diff --git a/examples/adsb/Cargo.toml b/examples/adsb/Cargo.toml index c3484246d..c29fb67a9 100644 --- a/examples/adsb/Cargo.toml +++ b/examples/adsb/Cargo.toml @@ -17,6 +17,7 @@ soapy = ["futuresdr/soapy"] [dependencies] adsb_deku = "0.7" +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features = ["seify"] } serde = { version = "1", features = ["derive"] } diff --git a/examples/adsb/src/bin/listen_adsb.rs b/examples/adsb/src/bin/listen_adsb.rs index 441ed7293..0219d0c95 100644 --- a/examples/adsb/src/bin/listen_adsb.rs +++ b/examples/adsb/src/bin/listen_adsb.rs @@ -3,9 +3,9 @@ use adsb_demod::Demodulator; use adsb_demod::PreambleDetector; use adsb_demod::Tracker; use adsb_demod::DEMOD_SAMPLE_RATE; +use anyhow::Result; use clap::command; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::Apply; use futuresdr::blocks::FileSource; diff --git a/examples/adsb/src/decoder.rs b/examples/adsb/src/decoder.rs index 70ae1274a..cd60a5cbe 100644 --- a/examples/adsb/src/decoder.rs +++ b/examples/adsb/src/decoder.rs @@ -1,7 +1,6 @@ use crate::DemodPacket; use adsb_deku::deku::DekuContainerRead; -use futuresdr::anyhow::bail; -use futuresdr::anyhow::Result; +use anyhow::bail; use futuresdr::macros::async_trait; use futuresdr::macros::message_handler; use futuresdr::runtime::BlockMeta; @@ -10,6 +9,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; diff --git a/examples/adsb/src/demodulator.rs b/examples/adsb/src/demodulator.rs index 7c07b2bf3..482986d28 100644 --- a/examples/adsb/src/demodulator.rs +++ b/examples/adsb/src/demodulator.rs @@ -1,7 +1,6 @@ use crate::N_SAMPLES_PER_HALF_SYM; use crate::SYMBOL_ONE_TAPS; use crate::SYMBOL_ZERO_TAPS; -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; @@ -9,6 +8,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; diff --git a/examples/adsb/src/preamble_detector.rs b/examples/adsb/src/preamble_detector.rs index af456379a..b7a482bfe 100644 --- a/examples/adsb/src/preamble_detector.rs +++ b/examples/adsb/src/preamble_detector.rs @@ -1,11 +1,11 @@ use crate::N_SAMPLES_PER_HALF_SYM; -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; diff --git a/examples/adsb/src/tracker.rs b/examples/adsb/src/tracker.rs index 908037c1a..a4e5a2f9b 100644 --- a/examples/adsb/src/tracker.rs +++ b/examples/adsb/src/tracker.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::async_io::Timer; use futuresdr::macros::async_trait; use futuresdr::macros::message_handler; @@ -8,6 +7,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/android-hw/Cargo.toml b/examples/android-hw/Cargo.toml index 0d0ae63d3..3a3c24d1e 100644 --- a/examples/android-hw/Cargo.toml +++ b/examples/android-hw/Cargo.toml @@ -9,5 +9,6 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] +anyhow = "1.0" futuresdr = { path = "../..", features = ["soapy"] } jni = { version = "0.21" } diff --git a/examples/android-hw/src/fft_shift.rs b/examples/android-hw/src/fft_shift.rs index 34b934ef2..651b7f169 100644 --- a/examples/android-hw/src/fft_shift.rs +++ b/examples/android-hw/src/fft_shift.rs @@ -1,6 +1,4 @@ -use std::marker::PhantomData; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; @@ -11,6 +9,7 @@ use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; +use std::marker::PhantomData; pub struct FftShift { _p: PhantomData, diff --git a/examples/android-hw/src/lib.rs b/examples/android-hw/src/lib.rs index 3c45a0968..0f08a5b7e 100644 --- a/examples/android-hw/src/lib.rs +++ b/examples/android-hw/src/lib.rs @@ -1,9 +1,6 @@ mod fft_shift; +use anyhow::Result; use fft_shift::FftShift; - -use std::env; - -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::Apply; use futuresdr::blocks::Fft; @@ -14,6 +11,7 @@ use futuresdr::num_complex::Complex32; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; use futuresdr::tracing::info; +use std::env; pub fn run_fg() -> Result<()> { futuresdr::runtime::init(); diff --git a/examples/android-hw/src/main.rs b/examples/android-hw/src/main.rs index 93be47af2..ae944b795 100644 --- a/examples/android-hw/src/main.rs +++ b/examples/android-hw/src/main.rs @@ -1,5 +1,5 @@ use androidhw::run_fg; -use futuresdr::anyhow::Result; +use anyhow::Result; fn main() -> Result<()> { run_fg()?; diff --git a/examples/android/Cargo.toml b/examples/android/Cargo.toml index 3a3d81201..28d71b581 100644 --- a/examples/android/Cargo.toml +++ b/examples/android/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] +anyhow = "1.0" futuresdr = { path = "../..", features = ["vulkan"] } jni = { version = "0.21" } rand = "0.8" diff --git a/examples/android/src/lib.rs b/examples/android/src/lib.rs index 3c4156573..a6095ede6 100644 --- a/examples/android/src/lib.rs +++ b/examples/android/src/lib.rs @@ -1,7 +1,4 @@ -use std::iter::repeat_with; -use std::sync::Arc; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Copy; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; @@ -13,6 +10,8 @@ use futuresdr::runtime::buffer::vulkan::H2D; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; use futuresdr::tracing::info; +use std::iter::repeat_with; +use std::sync::Arc; pub fn run_fg() -> Result<()> { let mut fg = Flowgraph::new(); diff --git a/examples/android/src/main.rs b/examples/android/src/main.rs index 66a050efa..1aab6c459 100644 --- a/examples/android/src/main.rs +++ b/examples/android/src/main.rs @@ -1,5 +1,5 @@ use androidfs::run_fg; -use futuresdr::anyhow::Result; +use anyhow::Result; fn main() -> Result<()> { run_fg()?; diff --git a/examples/audio/Cargo.toml b/examples/audio/Cargo.toml index 8058fe685..91b9ea94b 100644 --- a/examples/audio/Cargo.toml +++ b/examples/audio/Cargo.toml @@ -22,6 +22,6 @@ name = "play-selectable-tone" path = "play_selectable_tone.rs" [dependencies] -futuresdr = { path = "../..", features = ["audio", "zeromq"] } +anyhow = "1.0" clap = { version = "4", features = ["derive"] } - +futuresdr = { path = "../..", features = ["audio", "zeromq"] } diff --git a/examples/audio/play_file.rs b/examples/audio/play_file.rs index 133f656ce..9f055bc25 100644 --- a/examples/audio/play_file.rs +++ b/examples/audio/play_file.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::audio::FileSource; use futuresdr::runtime::Flowgraph; diff --git a/examples/audio/play_selectable_tone.rs b/examples/audio/play_selectable_tone.rs index 68ad557e3..c60d9eced 100644 --- a/examples/audio/play_selectable_tone.rs +++ b/examples/audio/play_selectable_tone.rs @@ -1,5 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::async_io; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::Selector; diff --git a/examples/audio/play_stereo.rs b/examples/audio/play_stereo.rs index 72c21b7fc..e49afc880 100644 --- a/examples/audio/play_stereo.rs +++ b/examples/audio/play_stereo.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::audio::FileSource; use futuresdr::blocks::ApplyNM; diff --git a/examples/audio/play_tone.rs b/examples/audio/play_tone.rs index f60a6757f..e13e1405f 100644 --- a/examples/audio/play_tone.rs +++ b/examples/audio/play_tone.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::SignalSourceBuilder; use futuresdr::runtime::Flowgraph; diff --git a/examples/ctrlport-demo.rs b/examples/ctrlport-demo.rs index b505f148a..d9c9b181a 100644 --- a/examples/ctrlport-demo.rs +++ b/examples/ctrlport-demo.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::macros::message_handler; use futuresdr::runtime::BlockMeta; diff --git a/examples/custom-routes/Cargo.toml b/examples/custom-routes/Cargo.toml index bae8ff07b..52ffa3bd8 100644 --- a/examples/custom-routes/Cargo.toml +++ b/examples/custom-routes/Cargo.toml @@ -6,5 +6,6 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" axum = "0.7" futuresdr = { path = "../../" } diff --git a/examples/custom-routes/src/main.rs b/examples/custom-routes/src/main.rs index aa9a75460..339e21ae5 100644 --- a/examples/custom-routes/src/main.rs +++ b/examples/custom-routes/src/main.rs @@ -1,17 +1,16 @@ +use anyhow::Result; use axum::extract::State; use axum::response::Html; use axum::routing::get; use axum::Router; -use std::sync::Arc; -use std::sync::Mutex; -use std::time; - -use futuresdr::anyhow::Result; use futuresdr::blocks::MessageSourceBuilder; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; use futuresdr::runtime::Runtime; use futuresdr::runtime::RuntimeHandle; +use std::sync::Arc; +use std::sync::Mutex; +use std::time; #[derive(Clone)] struct WebState { diff --git a/examples/cw/Cargo.toml b/examples/cw/Cargo.toml index 5faef48ec..7ce3dfd7a 100644 --- a/examples/cw/Cargo.toml +++ b/examples/cw/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] +anyhow = "1.0" futuresdr = { path = "../..", features = ["audio"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] diff --git a/examples/cw/src/bin/tx.rs b/examples/cw/src/bin/tx.rs index 36e9782df..354cf0937 100644 --- a/examples/cw/src/bin/tx.rs +++ b/examples/cw/src/bin/tx.rs @@ -1,9 +1,9 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; #[cfg(not(target_arch = "wasm32"))] mod foo { + use anyhow::Result; use clap::Parser; - use futuresdr::anyhow::Result; use futuresdr::async_io::block_on; use cw::run_fg; @@ -26,7 +26,7 @@ mod foo { #[cfg(target_arch = "wasm32")] mod foo { - use futuresdr::anyhow::Result; + use anyhow::Result; use leptos::html::Input; use leptos::*; diff --git a/examples/cw/src/lib.rs b/examples/cw/src/lib.rs index bbac00454..f7e016193 100644 --- a/examples/cw/src/lib.rs +++ b/examples/cw/src/lib.rs @@ -1,10 +1,10 @@ -use futuresdr::anyhow::Result; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::ApplyIntoIter; use futuresdr::blocks::Combine; use futuresdr::blocks::SignalSourceBuilder; use futuresdr::blocks::VectorSource; use futuresdr::runtime::Flowgraph; +use futuresdr::runtime::Result; use futuresdr::runtime::Runtime; use std::fmt; diff --git a/examples/debug/Cargo.toml b/examples/debug/Cargo.toml index bcc1d6645..d88a0d95f 100644 --- a/examples/debug/Cargo.toml +++ b/examples/debug/Cargo.toml @@ -18,6 +18,7 @@ name = "tag_debug" path = "tag_debug.rs" [dependencies] -futuresdr = { path = "../..", features = ['flow_scheduler', 'tpb_scheduler']} +anyhow = "1.0" clap = { version = "4", features = ["derive"] } +futuresdr = { path = "../..", features = ['flow_scheduler', 'tpb_scheduler']} diff --git a/examples/debug/oscillators.rs b/examples/debug/oscillators.rs index b31198444..9a06b6a1f 100644 --- a/examples/debug/oscillators.rs +++ b/examples/debug/oscillators.rs @@ -1,6 +1,3 @@ -use std::time; - -use futuresdr::anyhow::Result; use futuresdr::blocks::FileSink; use futuresdr::blocks::Head; use futuresdr::blocks::SignalSourceBuilder; @@ -8,8 +5,9 @@ use futuresdr::macros::connect; use futuresdr::num_complex::Complex32; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::time; -fn main() -> Result<()> { +fn main() -> anyhow::Result<()> { let sample_rate = 48_000.0; let freq = 4800.0; let items = 100_000_000; diff --git a/examples/debug/panic.rs b/examples/debug/panic.rs index 58928d7f6..336175979 100644 --- a/examples/debug/panic.rs +++ b/examples/debug/panic.rs @@ -1,7 +1,5 @@ use clap::Parser; use clap::ValueEnum; - -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::macros::connect; use futuresdr::runtime::scheduler; @@ -11,6 +9,7 @@ use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::Runtime; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; diff --git a/examples/debug/tag_debug.rs b/examples/debug/tag_debug.rs index aa20bc078..722961439 100644 --- a/examples/debug/tag_debug.rs +++ b/examples/debug/tag_debug.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::blocks::TagDebug; use futuresdr::blocks::VectorSource; use futuresdr::macros::async_trait; @@ -8,6 +7,7 @@ use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::Runtime; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; @@ -15,7 +15,7 @@ use futuresdr::runtime::Tag; use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; -fn main() -> Result<()> { +fn main() -> anyhow::Result<()> { let mut fg = Flowgraph::new(); let n_items = 10000; diff --git a/examples/egui/Cargo.toml b/examples/egui/Cargo.toml index 2c25c0b45..78155bba6 100644 --- a/examples/egui/Cargo.toml +++ b/examples/egui/Cargo.toml @@ -11,6 +11,7 @@ aaronia_http = ["futuresdr/aaronia_http"] soapy = ["futuresdr/soapy"] [dependencies] +anyhow ="1.0" eframe = "0.29" futuresdr = { path = "../..", features = ["seify"] } futuresdr-remote = { path = "../../crates/remote/" } diff --git a/examples/egui/src/bin/combined.rs b/examples/egui/src/bin/combined.rs index c0cd12860..1d93e56c2 100644 --- a/examples/egui/src/bin/combined.rs +++ b/examples/egui/src/bin/combined.rs @@ -1,10 +1,10 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] +use anyhow::Result; use eframe::egui; use eframe::egui::mutex::Mutex; use eframe::egui::widgets::SliderClamping; use eframe::egui_glow; use eframe::glow; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::Fft; use futuresdr::blocks::FftDirection; @@ -46,7 +46,7 @@ enum GuiAction { async fn process_gui_actions( mut rx: Receiver, mut handle: FlowgraphHandle, -) -> futuresdr::anyhow::Result<()> { +) -> anyhow::Result<()> { while let Some(m) = rx.next().await { match m { GuiAction::SetFreq(f) => { diff --git a/examples/egui/src/bin/egui.rs b/examples/egui/src/bin/egui.rs index 7075751a9..74b2a46a5 100644 --- a/examples/egui/src/bin/egui.rs +++ b/examples/egui/src/bin/egui.rs @@ -40,9 +40,7 @@ enum GuiAction { SetFreq(u64), } -async fn process_gui_actions( - mut rx: UnboundedReceiver, -) -> futuresdr::anyhow::Result<()> { +async fn process_gui_actions(mut rx: UnboundedReceiver) -> anyhow::Result<()> { let remote = Remote::new("http://127.0.0.1:1337"); let fgs = remote.flowgraphs().await?; let sdr = &fgs[0].blocks()[0]; diff --git a/examples/egui/src/bin/fg.rs b/examples/egui/src/bin/fg.rs index ee2ad6c55..3723e89f3 100644 --- a/examples/egui/src/bin/fg.rs +++ b/examples/egui/src/bin/fg.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::Fft; use futuresdr::blocks::FftDirection; @@ -11,7 +10,7 @@ use futuresdr::runtime::Runtime; use futuresdr_egui::FFT_SIZE; -fn main() -> Result<()> { +fn main() -> anyhow::Result<()> { let mut fg = Flowgraph::new(); let src = SourceBuilder::new() diff --git a/examples/egui/src/channel_sink.rs b/examples/egui/src/channel_sink.rs index 402b51742..653eb60ec 100644 --- a/examples/egui/src/channel_sink.rs +++ b/examples/egui/src/channel_sink.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::futures::channel::mpsc::Sender; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; @@ -6,6 +5,7 @@ use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/file-trx/Cargo.toml b/examples/file-trx/Cargo.toml index 6f2901a20..dd889f001 100644 --- a/examples/file-trx/Cargo.toml +++ b/examples/file-trx/Cargo.toml @@ -20,5 +20,6 @@ aaronia_http = ["futuresdr/aaronia_http"] soapy = ["futuresdr/soapy"] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features = ["seify"] } diff --git a/examples/file-trx/rx.rs b/examples/file-trx/rx.rs index e35d31d47..4f9f41d10 100644 --- a/examples/file-trx/rx.rs +++ b/examples/file-trx/rx.rs @@ -1,5 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::Apply; use futuresdr::blocks::FileSink; diff --git a/examples/file-trx/tx.rs b/examples/file-trx/tx.rs index e3678eb0f..d642ca36b 100644 --- a/examples/file-trx/tx.rs +++ b/examples/file-trx/tx.rs @@ -1,5 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SinkBuilder; use futuresdr::blocks::Apply; use futuresdr::blocks::FileSource; diff --git a/examples/files.rs b/examples/files.rs index 5271ba475..967e00d26 100644 --- a/examples/files.rs +++ b/examples/files.rs @@ -1,10 +1,9 @@ -use std::time; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::FileSink; use futuresdr::blocks::FileSource; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::time; fn main() -> Result<()> { let args: Vec = std::env::args().collect(); diff --git a/examples/firdes/Cargo.toml b/examples/firdes/Cargo.toml index 907c1e56f..5056de6c7 100644 --- a/examples/firdes/Cargo.toml +++ b/examples/firdes/Cargo.toml @@ -6,5 +6,6 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" futuresdr = { path = "../..", features = ["audio"] } futuredsp = { path = "../../crates/futuredsp" } diff --git a/examples/firdes/src/main.rs b/examples/firdes/src/main.rs index 748b036e4..3b236ee40 100644 --- a/examples/firdes/src/main.rs +++ b/examples/firdes/src/main.rs @@ -1,3 +1,4 @@ +use futuredsp::firdes; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::FirBuilder; use futuresdr::blocks::Source; @@ -5,10 +6,7 @@ use futuresdr::runtime::Block; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; -use futuredsp::firdes; -use futuresdr::anyhow::Result; - -fn main() -> Result<()> { +fn main() -> anyhow::Result<()> { let mut fg = Flowgraph::new(); const SAMPLING_FREQ: u32 = 66_150; diff --git a/examples/fm-receiver/Cargo.toml b/examples/fm-receiver/Cargo.toml index f5efa0887..714a17c2c 100644 --- a/examples/fm-receiver/Cargo.toml +++ b/examples/fm-receiver/Cargo.toml @@ -6,5 +6,6 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features=["soapy", "audio", "rtlsdr"] } diff --git a/examples/fm-receiver/src/main.rs b/examples/fm-receiver/src/main.rs index 86e39af89..b3e2b451e 100644 --- a/examples/fm-receiver/src/main.rs +++ b/examples/fm-receiver/src/main.rs @@ -10,9 +10,8 @@ //! **Watch out** though: Some frequencies (very high or very low) might be unsupported //! by your SDR and may cause a crash. +use anyhow::Result; use clap::Parser; - -use futuresdr::anyhow::Result; use futuresdr::async_io; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::seify::SourceBuilder; diff --git a/examples/keyfob/Cargo.toml b/examples/keyfob/Cargo.toml index 6780d23ae..eacc06d6f 100644 --- a/examples/keyfob/Cargo.toml +++ b/examples/keyfob/Cargo.toml @@ -11,5 +11,6 @@ aaronia_http = ["futuresdr/aaronia_http"] soapy = ["futuresdr/soapy"] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features=["seify"] } diff --git a/examples/keyfob/src/decoder.rs b/examples/keyfob/src/decoder.rs index 303105620..ea476eea9 100644 --- a/examples/keyfob/src/decoder.rs +++ b/examples/keyfob/src/decoder.rs @@ -1,10 +1,10 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/keyfob/src/main.rs b/examples/keyfob/src/main.rs index c26736198..e314e1873 100644 --- a/examples/keyfob/src/main.rs +++ b/examples/keyfob/src/main.rs @@ -1,5 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::Apply; use futuresdr::blocks::FileSource; diff --git a/examples/logging/Cargo.toml b/examples/logging/Cargo.toml index 1f71af335..c348ff542 100644 --- a/examples/logging/Cargo.toml +++ b/examples/logging/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" futuresdr = { path = "../.." } tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] } diff --git a/examples/logging/logging.rs b/examples/logging/logging.rs index 0d8133d81..15adf6cd3 100644 --- a/examples/logging/logging.rs +++ b/examples/logging/logging.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::MessageSourceBuilder; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; diff --git a/examples/lora/Cargo.toml b/examples/lora/Cargo.toml index 5ab8c002f..e979de1b9 100644 --- a/examples/lora/Cargo.toml +++ b/examples/lora/Cargo.toml @@ -9,7 +9,9 @@ license = "GPL-3.0-only" [dependencies] aes = "0.8" +anyhow = "1.0" base64 = "0.22" +chrono = "0.4.38" clap = { version = "4.5", features = ["derive"] } ctr = "0.9" futuredsp = { path = "../../crates/futuredsp" } @@ -19,7 +21,6 @@ num-traits = "0.2" rustfft = "6.2" scilib = "1.0" semtech-udp = { version = "0.11.0", features = ["client"] } -triggered = "0.1.2" -tokio = { version = "1.38.1", features = ["rt-multi-thread"] } structopt = "0.3.26" -chrono = "0.4.38" +tokio = { version = "1.38.1", features = ["rt-multi-thread"] } +triggered = "0.1.2" diff --git a/examples/lora/src/bin/loopback.rs b/examples/lora/src/bin/loopback.rs index d4b4dcc09..b776987f2 100644 --- a/examples/lora/src/bin/loopback.rs +++ b/examples/lora/src/bin/loopback.rs @@ -1,6 +1,6 @@ +use anyhow::anyhow; +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::anyhow; -use futuresdr::anyhow::Result; use futuresdr::async_io::Timer; use futuresdr::blocks::BlobToUdp; use futuresdr::macros::connect; diff --git a/examples/lora/src/bin/rx.rs b/examples/lora/src/bin/rx.rs index e4fb8a0a3..ca0899eaf 100644 --- a/examples/lora/src/bin/rx.rs +++ b/examples/lora/src/bin/rx.rs @@ -1,7 +1,6 @@ +use anyhow::anyhow; +use anyhow::Result; use clap::Parser; - -use futuresdr::anyhow::anyhow; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::BlobToUdp; use futuresdr::macros::connect; diff --git a/examples/lora/src/bin/rx_all_channels_eu.rs b/examples/lora/src/bin/rx_all_channels_eu.rs index 40c04b72c..7b4f8583b 100644 --- a/examples/lora/src/bin/rx_all_channels_eu.rs +++ b/examples/lora/src/bin/rx_all_channels_eu.rs @@ -1,6 +1,6 @@ +use anyhow::Result; use clap::Parser; use futuredsp::firdes::remez; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::BlobToUdp; use futuresdr::blocks::MessageAnnotator; diff --git a/examples/lora/src/bin/rx_meshtastic.rs b/examples/lora/src/bin/rx_meshtastic.rs index 9db90c441..e3ce4e382 100644 --- a/examples/lora/src/bin/rx_meshtastic.rs +++ b/examples/lora/src/bin/rx_meshtastic.rs @@ -1,6 +1,6 @@ +use anyhow::Result; use clap::Parser; use futuredsp::firdes; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::MessagePipe; use futuresdr::blocks::XlatingFirBuilder; diff --git a/examples/lora/src/bin/rx_meshtastic_all_channels.rs b/examples/lora/src/bin/rx_meshtastic_all_channels.rs index acfdc24db..055fe32ef 100644 --- a/examples/lora/src/bin/rx_meshtastic_all_channels.rs +++ b/examples/lora/src/bin/rx_meshtastic_all_channels.rs @@ -1,6 +1,6 @@ +use anyhow::Result; use clap::Parser; use futuredsp::firdes; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::MessagePipe; use futuresdr::blocks::XlatingFirBuilder; diff --git a/examples/lora/src/bin/tx.rs b/examples/lora/src/bin/tx.rs index f809d773d..2f104ddb8 100644 --- a/examples/lora/src/bin/tx.rs +++ b/examples/lora/src/bin/tx.rs @@ -1,5 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::async_io::Timer; use futuresdr::blocks::seify::SinkBuilder; use futuresdr::macros::connect; diff --git a/examples/lora/src/bin/tx_meshtastic.rs b/examples/lora/src/bin/tx_meshtastic.rs index aecd745ae..753208191 100644 --- a/examples/lora/src/bin/tx_meshtastic.rs +++ b/examples/lora/src/bin/tx_meshtastic.rs @@ -1,5 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SinkBuilder; use futuresdr::macros::connect; use futuresdr::runtime::BlockT; diff --git a/examples/lora/src/deinterleaver.rs b/examples/lora/src/deinterleaver.rs index 65c2d8af4..0dd1dc318 100644 --- a/examples/lora/src/deinterleaver.rs +++ b/examples/lora/src/deinterleaver.rs @@ -1,6 +1,5 @@ use std::collections::HashMap; -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; @@ -9,6 +8,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; diff --git a/examples/lora/src/fft_demod.rs b/examples/lora/src/fft_demod.rs index f7f80e4ad..7df08468d 100644 --- a/examples/lora/src/fft_demod.rs +++ b/examples/lora/src/fft_demod.rs @@ -1,8 +1,3 @@ -use rustfft::FftPlanner; -use std::collections::HashMap; -use std::sync::Arc; - -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::num_complex::Complex32; use futuresdr::num_complex::Complex64; @@ -13,12 +8,16 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; use futuresdr::tracing::warn; +use rustfft::FftPlanner; +use std::collections::HashMap; +use std::sync::Arc; use crate::utils::*; diff --git a/examples/lora/src/frame_sync.rs b/examples/lora/src/frame_sync.rs index c1c150552..2b91e78dc 100644 --- a/examples/lora/src/frame_sync.rs +++ b/examples/lora/src/frame_sync.rs @@ -1,14 +1,3 @@ -use rustfft::Fft; -use rustfft::FftDirection; -use rustfft::FftPlanner; -use std::collections::HashMap; -use std::f32::consts::PI; -use std::str::FromStr; -use std::sync::Arc; -use std::time::SystemTime; -use std::time::UNIX_EPOCH; - -use futuresdr::anyhow::Result; use futuresdr::futures::channel::mpsc; use futuresdr::macros::async_trait; use futuresdr::macros::message_handler; @@ -19,6 +8,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; @@ -27,6 +17,15 @@ use futuresdr::runtime::WorkIo; use futuresdr::tracing::debug; use futuresdr::tracing::info; use futuresdr::tracing::warn; +use rustfft::Fft; +use rustfft::FftDirection; +use rustfft::FftPlanner; +use std::collections::HashMap; +use std::f32::consts::PI; +use std::str::FromStr; +use std::sync::Arc; +use std::time::SystemTime; +use std::time::UNIX_EPOCH; use crate::utils::*; @@ -329,7 +328,7 @@ impl FrameSync { _mio: &'a mut MessageIo, _meta: &'a mut BlockMeta, _p: Pmt, - ) -> std::result::Result { + ) -> Result { io.call_again = true; Ok(Pmt::Null) } diff --git a/examples/lora/src/gray_mapping.rs b/examples/lora/src/gray_mapping.rs index 2cc942bf0..bf91ce9fe 100644 --- a/examples/lora/src/gray_mapping.rs +++ b/examples/lora/src/gray_mapping.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; @@ -7,6 +6,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; diff --git a/examples/lora/src/hamming_dec.rs b/examples/lora/src/hamming_dec.rs index 073b7190a..61fd18c3c 100644 --- a/examples/lora/src/hamming_dec.rs +++ b/examples/lora/src/hamming_dec.rs @@ -2,7 +2,6 @@ use std::cmp::min; use std::collections::HashMap; use std::collections::VecDeque; -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; @@ -11,6 +10,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; diff --git a/examples/lora/src/header_decoder.rs b/examples/lora/src/header_decoder.rs index 0d0345eec..08b776ab0 100644 --- a/examples/lora/src/header_decoder.rs +++ b/examples/lora/src/header_decoder.rs @@ -1,7 +1,3 @@ -use std::cmp::min; -use std::collections::HashMap; - -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; @@ -10,6 +6,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; @@ -17,6 +14,8 @@ use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; use futuresdr::tracing::debug; use futuresdr::tracing::info; +use std::cmp::min; +use std::collections::HashMap; #[derive(Debug, Clone)] pub struct Frame { diff --git a/examples/lora/src/stream_adder.rs b/examples/lora/src/stream_adder.rs index f84d657f2..29c2f4e21 100644 --- a/examples/lora/src/stream_adder.rs +++ b/examples/lora/src/stream_adder.rs @@ -1,10 +1,10 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/lora/src/transmitter.rs b/examples/lora/src/transmitter.rs index 87306cf9f..43a6efd51 100644 --- a/examples/lora/src/transmitter.rs +++ b/examples/lora/src/transmitter.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::macros::message_handler; use futuresdr::num_complex::Complex32; diff --git a/examples/m17/Cargo.toml b/examples/m17/Cargo.toml index 6c508003d..eb072cdf2 100644 --- a/examples/m17/Cargo.toml +++ b/examples/m17/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } codec2 = "0.3" futuresdr = { path = "../..", features = ["audio", "seify", "soapy"] } diff --git a/examples/m17/src/bin/rx.rs b/examples/m17/src/bin/rx.rs index 9260fa21f..a7a83ea67 100644 --- a/examples/m17/src/bin/rx.rs +++ b/examples/m17/src/bin/rx.rs @@ -1,7 +1,7 @@ #![allow(clippy::excessive_precision)] +use anyhow::Result; use codec2::Codec2; use codec2::Codec2Mode; -use futuresdr::anyhow::Result; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::Apply; use futuresdr::blocks::ApplyNM; diff --git a/examples/m17/src/bin/tx.rs b/examples/m17/src/bin/tx.rs index 10beb6f73..c9964f214 100644 --- a/examples/m17/src/bin/tx.rs +++ b/examples/m17/src/bin/tx.rs @@ -1,7 +1,7 @@ #![allow(clippy::excessive_precision)] +use anyhow::Result; use codec2::Codec2; use codec2::Codec2Mode; -use futuresdr::anyhow::Result; use futuresdr::blocks::Apply; use futuresdr::blocks::ApplyNM; use futuresdr::blocks::FileSink; diff --git a/examples/m17/src/decoder_block.rs b/examples/m17/src/decoder_block.rs index 0fe9af7f7..dab645deb 100644 --- a/examples/m17/src/decoder_block.rs +++ b/examples/m17/src/decoder_block.rs @@ -1,10 +1,10 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/m17/src/encoder_block.rs b/examples/m17/src/encoder_block.rs index 01bb50277..40bfcc7ba 100644 --- a/examples/m17/src/encoder_block.rs +++ b/examples/m17/src/encoder_block.rs @@ -1,10 +1,10 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/m17/src/moving_average.rs b/examples/m17/src/moving_average.rs index bf675e895..ca4dcf965 100644 --- a/examples/m17/src/moving_average.rs +++ b/examples/m17/src/moving_average.rs @@ -1,10 +1,10 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/m17/src/symbol_sync.rs b/examples/m17/src/symbol_sync.rs index ca5627656..78ef28b5e 100644 --- a/examples/m17/src/symbol_sync.rs +++ b/examples/m17/src/symbol_sync.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::num_complex::Complex32; use futuresdr::num_integer::Integer; @@ -7,6 +6,7 @@ use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/macros/Cargo.toml b/examples/macros/Cargo.toml index d0e3a187b..29b1fd0a6 100644 --- a/examples/macros/Cargo.toml +++ b/examples/macros/Cargo.toml @@ -6,4 +6,5 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" futuresdr = { path = "../.." } diff --git a/examples/macros/src/main.rs b/examples/macros/src/main.rs index a5fd5e377..4f69267cd 100644 --- a/examples/macros/src/main.rs +++ b/examples/macros/src/main.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::blocks::Copy; use futuresdr::blocks::MessageCopy; use futuresdr::blocks::MessageSink; @@ -15,13 +14,14 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::Runtime; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; -fn main() -> Result<()> { +fn main() -> anyhow::Result<()> { let mut fg = Flowgraph::new(); let src = VectorSource::new(vec![0u32, 1, 2, 3]); diff --git a/examples/message-passing.rs b/examples/message-passing.rs index 75dd7038a..77e88d25f 100644 --- a/examples/message-passing.rs +++ b/examples/message-passing.rs @@ -1,12 +1,11 @@ -use std::time; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::MessageCopy; use futuresdr::blocks::MessageSink; use futuresdr::blocks::MessageSourceBuilder; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; use futuresdr::runtime::Runtime; +use std::time; fn main() -> Result<()> { let mut fg = Flowgraph::new(); diff --git a/examples/rattlegram/Cargo.toml b/examples/rattlegram/Cargo.toml index 04817e45c..f427093f3 100644 --- a/examples/rattlegram/Cargo.toml +++ b/examples/rattlegram/Cargo.toml @@ -9,6 +9,7 @@ crate-type = ["cdylib", "rlib"] [workspace] [dependencies] +anyhow = "1.0" crc = "3.2" futuresdr = { path = "../..", features = ["audio"] } rustfft = "6.2" diff --git a/examples/rattlegram/src/bin/rx.rs b/examples/rattlegram/src/bin/rx.rs index 361bf3eb5..1d26ac05f 100644 --- a/examples/rattlegram/src/bin/rx.rs +++ b/examples/rattlegram/src/bin/rx.rs @@ -1,5 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::blocks::audio::AudioSource; use futuresdr::blocks::audio::FileSource; use futuresdr::macros::connect; diff --git a/examples/rattlegram/src/bin/trx.rs b/examples/rattlegram/src/bin/trx.rs index 6e89ef54c..d768ca11d 100644 --- a/examples/rattlegram/src/bin/trx.rs +++ b/examples/rattlegram/src/bin/trx.rs @@ -1,5 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::audio::AudioSource; use futuresdr::blocks::ChannelSource; diff --git a/examples/rattlegram/src/bin/tx.rs b/examples/rattlegram/src/bin/tx.rs index da9150226..3961e4e65 100644 --- a/examples/rattlegram/src/bin/tx.rs +++ b/examples/rattlegram/src/bin/tx.rs @@ -1,6 +1,6 @@ +use anyhow::bail; +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::bail; -use futuresdr::anyhow::Result; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::VectorSource; use futuresdr::macros::connect; diff --git a/examples/rattlegram/src/decoder.rs b/examples/rattlegram/src/decoder.rs index cd89618e0..a13a89dcf 100644 --- a/examples/rattlegram/src/decoder.rs +++ b/examples/rattlegram/src/decoder.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::num_complex::Complex32; use futuresdr::runtime::BlockMeta; @@ -6,6 +5,7 @@ use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/rattlegram/src/wasm.rs b/examples/rattlegram/src/wasm.rs index 7836212c9..762a7be65 100644 --- a/examples/rattlegram/src/wasm.rs +++ b/examples/rattlegram/src/wasm.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::ChannelSource; use futuresdr::futures::channel::mpsc; diff --git a/examples/scheduler.rs b/examples/scheduler.rs index cd48335c1..c5276c801 100644 --- a/examples/scheduler.rs +++ b/examples/scheduler.rs @@ -1,8 +1,6 @@ +use anyhow::Result; use async_io::block_on; use async_io::Timer; -use std::time::Duration; - -use futuresdr::anyhow::Result; use futuresdr::blocks::MessageSourceBuilder; use futuresdr::runtime::scheduler::FlowScheduler; use futuresdr::runtime::scheduler::Scheduler; @@ -11,6 +9,7 @@ use futuresdr::runtime::scheduler::TpbScheduler; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; use futuresdr::runtime::Runtime; +use std::time::Duration; fn create_fg() -> Flowgraph { let mut fg = Flowgraph::new(); diff --git a/examples/spectrum/Cargo.toml b/examples/spectrum/Cargo.toml index 6b56415b8..99b2cf407 100644 --- a/examples/spectrum/Cargo.toml +++ b/examples/spectrum/Cargo.toml @@ -23,6 +23,7 @@ vulkan = [ "futuresdr/vulkan", "vulkano", "vulkano-shaders"] wgpu = [ "futuresdr/wgpu" ] [dependencies] +anyhow = "1.0" futuresdr = { path = "../.." } vulkano = { version = "0.34", optional = true } vulkano-shaders = { version = "0.34", optional = true } diff --git a/examples/spectrum/src/bin/cpu.rs b/examples/spectrum/src/bin/cpu.rs index e7bc26342..5e80bc535 100644 --- a/examples/spectrum/src/bin/cpu.rs +++ b/examples/spectrum/src/bin/cpu.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::Fft; use futuresdr::blocks::FftDirection; diff --git a/examples/spectrum/src/bin/vulkan.rs b/examples/spectrum/src/bin/vulkan.rs index c8f3b8ba7..c144233e7 100644 --- a/examples/spectrum/src/bin/vulkan.rs +++ b/examples/spectrum/src/bin/vulkan.rs @@ -1,6 +1,4 @@ -use std::sync::Arc; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::Fft; use futuresdr::blocks::MovingAvg; @@ -10,6 +8,7 @@ use futuresdr::runtime::buffer::vulkan; use futuresdr::runtime::buffer::vulkan::Broker; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::sync::Arc; use spectrum::power_block; use spectrum::Vulkan; diff --git a/examples/spectrum/src/vulkan.rs b/examples/spectrum/src/vulkan.rs index 8b68ce427..4133e903e 100644 --- a/examples/spectrum/src/vulkan.rs +++ b/examples/spectrum/src/vulkan.rs @@ -1,22 +1,4 @@ -use std::sync::Arc; -use vulkano::buffer::BufferUsage; -use vulkano::buffer::CpuAccessibleBuffer; -use vulkano::command_buffer::allocator::StandardCommandBufferAllocator; -use vulkano::command_buffer::AutoCommandBufferBuilder; -use vulkano::command_buffer::CommandBufferUsage; -use vulkano::descriptor_set::allocator::StandardDescriptorSetAllocator; -use vulkano::descriptor_set::layout::DescriptorSetLayout; -use vulkano::descriptor_set::PersistentDescriptorSet; -use vulkano::descriptor_set::WriteDescriptorSet; -use vulkano::memory::allocator::StandardMemoryAllocator; -use vulkano::pipeline::ComputePipeline; -use vulkano::pipeline::Pipeline; -use vulkano::pipeline::PipelineBindPoint; -use vulkano::sync::GpuFuture; -use vulkano::sync::{self}; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; +use anyhow::Context; use futuresdr::macros::async_trait; use futuresdr::runtime::buffer::vulkan::Broker; use futuresdr::runtime::buffer::vulkan::BufferEmpty; @@ -28,11 +10,28 @@ use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; use futuresdr::tracing::debug; +use std::sync::Arc; +use vulkano::buffer::BufferUsage; +use vulkano::buffer::CpuAccessibleBuffer; +use vulkano::command_buffer::allocator::StandardCommandBufferAllocator; +use vulkano::command_buffer::AutoCommandBufferBuilder; +use vulkano::command_buffer::CommandBufferUsage; +use vulkano::descriptor_set::allocator::StandardDescriptorSetAllocator; +use vulkano::descriptor_set::layout::DescriptorSetLayout; +use vulkano::descriptor_set::PersistentDescriptorSet; +use vulkano::descriptor_set::WriteDescriptorSet; +use vulkano::memory::allocator::StandardMemoryAllocator; +use vulkano::pipeline::ComputePipeline; +use vulkano::pipeline::Pipeline; +use vulkano::pipeline::PipelineBindPoint; +use vulkano::sync::GpuFuture; +use vulkano::sync::{self}; #[allow(clippy::needless_question_mark)] #[allow(deprecated)] diff --git a/examples/spectrum/src/wasm/web.rs b/examples/spectrum/src/wasm/web.rs index 80ce01286..6be1bbf25 100644 --- a/examples/spectrum/src/wasm/web.rs +++ b/examples/spectrum/src/wasm/web.rs @@ -1,17 +1,3 @@ -use prophecy::leptos::html::Span; -use prophecy::leptos::wasm_bindgen::JsCast; -use prophecy::leptos::*; -use prophecy::FlowgraphMermaid; -use prophecy::ListSelector; -use prophecy::TimeSink; -use prophecy::TimeSinkMode; -use prophecy::Waterfall; -use prophecy::WaterfallMode; -use std::cell::RefCell; -use std::rc::Rc; -use web_sys::HtmlInputElement; - -use futuresdr::anyhow::Result; use futuresdr::blocks::wasm::HackRf; use futuresdr::blocks::Fft; use futuresdr::blocks::FftDirection; @@ -26,11 +12,24 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::Runtime; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; +use prophecy::leptos::html::Span; +use prophecy::leptos::wasm_bindgen::JsCast; +use prophecy::leptos::*; +use prophecy::FlowgraphMermaid; +use prophecy::ListSelector; +use prophecy::TimeSink; +use prophecy::TimeSinkMode; +use prophecy::Waterfall; +use prophecy::WaterfallMode; +use std::cell::RefCell; +use std::rc::Rc; +use web_sys::HtmlInputElement; const FFT_SIZE: usize = 2048; diff --git a/examples/ssb/Cargo.toml b/examples/ssb/Cargo.toml index 92540ac00..c4f9e286e 100644 --- a/examples/ssb/Cargo.toml +++ b/examples/ssb/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features=["soapy", "audio"] } hound = "3.5" diff --git a/examples/ssb/receive.rs b/examples/ssb/receive.rs index dd90c101a..2982b0a83 100644 --- a/examples/ssb/receive.rs +++ b/examples/ssb/receive.rs @@ -1,6 +1,5 @@ +use anyhow::Result; use clap::Parser; - -use futuresdr::anyhow::Result; use futuresdr::blocks::audio::AudioSink; use futuresdr::blocks::Apply; use futuresdr::blocks::FileSource; diff --git a/examples/ssb/transmit.rs b/examples/ssb/transmit.rs index 08cf9b35c..fb4bc4ab8 100644 --- a/examples/ssb/transmit.rs +++ b/examples/ssb/transmit.rs @@ -1,5 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::blocks::audio::*; use futuresdr::blocks::Apply; use futuresdr::blocks::ApplyNM; diff --git a/examples/vect.rs b/examples/vect.rs index f6ab59d1a..a770732eb 100644 --- a/examples/vect.rs +++ b/examples/vect.rs @@ -1,14 +1,13 @@ -use std::iter::repeat_with; -use std::time; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; +use anyhow::Context; +use anyhow::Result; use futuresdr::blocks::Copy; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; use futuresdr::blocks::VectorSource; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::iter::repeat_with; +use std::time; fn main() -> Result<()> { let mut fg = Flowgraph::new(); diff --git a/examples/vulkan.rs b/examples/vulkan.rs index 5ca8a06d2..e3f37eab8 100644 --- a/examples/vulkan.rs +++ b/examples/vulkan.rs @@ -1,7 +1,4 @@ -use std::iter::repeat_with; -use std::sync::Arc; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; use futuresdr::blocks::VectorSource; @@ -10,6 +7,8 @@ use futuresdr::runtime::buffer::vulkan; use futuresdr::runtime::buffer::vulkan::Broker; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::iter::repeat_with; +use std::sync::Arc; fn main() -> Result<()> { let mut fg = Flowgraph::new(); diff --git a/examples/wasm/Cargo.toml b/examples/wasm/Cargo.toml index 1e6906a72..97367279e 100644 --- a/examples/wasm/Cargo.toml +++ b/examples/wasm/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] +anyhow = "1.0" futuresdr = { path = "../.." } rand = "0.8" diff --git a/examples/wasm/src/bin/flowgraph.rs b/examples/wasm/src/bin/flowgraph.rs index 634ccec24..51e842743 100644 --- a/examples/wasm/src/bin/flowgraph.rs +++ b/examples/wasm/src/bin/flowgraph.rs @@ -1,5 +1,5 @@ #[cfg(not(target_arch = "wasm32"))] -fn main() -> futuresdr::anyhow::Result<()> { +fn main() -> anyhow::Result<()> { futuresdr::async_io::block_on(wasm::run()) } diff --git a/examples/wasm/src/lib.rs b/examples/wasm/src/lib.rs index e5124182e..c1ac2d734 100644 --- a/examples/wasm/src/lib.rs +++ b/examples/wasm/src/lib.rs @@ -1,7 +1,5 @@ -use std::iter::repeat_with; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; +use anyhow::Context; +use anyhow::Result; use futuresdr::blocks::Apply; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; @@ -9,6 +7,7 @@ use futuresdr::blocks::VectorSource; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; use futuresdr::tracing::info; +use std::iter::repeat_with; pub async fn run() -> Result<()> { let n_items = 100_000; diff --git a/examples/websocket.rs b/examples/websocket.rs index 8a98f6e2d..8abd43d2c 100644 --- a/examples/websocket.rs +++ b/examples/websocket.rs @@ -1,11 +1,10 @@ -use std::iter::repeat_with; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Throttle; use futuresdr::blocks::VectorSource; use futuresdr::blocks::WebsocketSinkBuilder; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::iter::repeat_with; fn main() -> Result<()> { let mut fg = Flowgraph::new(); diff --git a/examples/wgpu/Cargo.toml b/examples/wgpu/Cargo.toml index 026550517..34aa2fe85 100644 --- a/examples/wgpu/Cargo.toml +++ b/examples/wgpu/Cargo.toml @@ -13,6 +13,7 @@ name = "loopback" path = "src/loopback.rs" [dependencies] +anyhow = "1.0" futuresdr = { path = "../..", features = ["wgpu"] } rand = "0.8" diff --git a/examples/wgpu/src/lib.rs b/examples/wgpu/src/lib.rs index 1fd827189..cf20d74cd 100644 --- a/examples/wgpu/src/lib.rs +++ b/examples/wgpu/src/lib.rs @@ -1,7 +1,5 @@ -use std::iter::repeat_with; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; +use anyhow::Context; +use anyhow::Result; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSource; use futuresdr::blocks::Wgpu; @@ -9,6 +7,7 @@ use futuresdr::runtime::buffer::wgpu; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; use futuresdr::tracing::info; +use std::iter::repeat_with; pub async fn run() { run_inner().await.unwrap() diff --git a/examples/wlan/Cargo.toml b/examples/wlan/Cargo.toml index ea2a786e6..8cb40a234 100644 --- a/examples/wlan/Cargo.toml +++ b/examples/wlan/Cargo.toml @@ -24,6 +24,7 @@ aaronia_http = ["futuresdr/aaronia_http"] soapy = ["futuresdr/soapy"] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } crc32fast = "1.4" futuresdr = { path = "../..", features = ["seify"] } diff --git a/examples/wlan/src/bin/loopback.rs b/examples/wlan/src/bin/loopback.rs index a7c000a6d..d0c66b03b 100644 --- a/examples/wlan/src/bin/loopback.rs +++ b/examples/wlan/src/bin/loopback.rs @@ -1,10 +1,4 @@ -use futuresdr::futures::channel::mpsc; -use futuresdr::futures::StreamExt; -use rand_distr::Distribution; -use rand_distr::Normal; -use std::time::Duration; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::async_io::Timer; use futuresdr::blocks::Apply; use futuresdr::blocks::Combine; @@ -13,6 +7,8 @@ use futuresdr::blocks::Fft; use futuresdr::blocks::FftDirection; use futuresdr::blocks::MessagePipe; use futuresdr::blocks::WebsocketPmtSink; +use futuresdr::futures::channel::mpsc; +use futuresdr::futures::StreamExt; use futuresdr::num_complex::Complex32; use futuresdr::runtime::buffer::circular::Circular; use futuresdr::runtime::copy_tag_propagation; @@ -20,6 +16,9 @@ use futuresdr::runtime::BlockT; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; use futuresdr::runtime::Runtime; +use rand_distr::Distribution; +use rand_distr::Normal; +use std::time::Duration; use wlan::Decoder; use wlan::Encoder; diff --git a/examples/wlan/src/bin/rx.rs b/examples/wlan/src/bin/rx.rs index 22e164ad5..62628fa1d 100644 --- a/examples/wlan/src/bin/rx.rs +++ b/examples/wlan/src/bin/rx.rs @@ -1,8 +1,4 @@ use clap::Parser; -use futuresdr::futures::channel::mpsc; -use futuresdr::futures::StreamExt; - -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::Apply; use futuresdr::blocks::Combine; @@ -10,12 +6,15 @@ use futuresdr::blocks::Delay; use futuresdr::blocks::Fft; use futuresdr::blocks::MessagePipe; use futuresdr::blocks::WebsocketPmtSink; +use futuresdr::futures::channel::mpsc; +use futuresdr::futures::StreamExt; use futuresdr::macros::connect; use futuresdr::num_complex::Complex32; use futuresdr::runtime::copy_tag_propagation; use futuresdr::runtime::BlockT; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::Runtime; use wlan::parse_channel; diff --git a/examples/wlan/src/bin/rx_udp.rs b/examples/wlan/src/bin/rx_udp.rs index c9b0410cd..c767535af 100644 --- a/examples/wlan/src/bin/rx_udp.rs +++ b/examples/wlan/src/bin/rx_udp.rs @@ -1,8 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::futures::channel::mpsc; -use futuresdr::futures::StreamExt; - -use futuresdr::anyhow::Result; use futuresdr::blocks::Apply; use futuresdr::blocks::Combine; use futuresdr::blocks::Delay; @@ -10,6 +7,8 @@ use futuresdr::blocks::Fft; use futuresdr::blocks::MessagePipe; use futuresdr::blocks::UdpSource; use futuresdr::blocks::WebsocketPmtSink; +use futuresdr::futures::channel::mpsc; +use futuresdr::futures::StreamExt; use futuresdr::macros::connect; use futuresdr::num_complex::Complex32; use futuresdr::runtime::copy_tag_propagation; diff --git a/examples/wlan/src/bin/tx.rs b/examples/wlan/src/bin/tx.rs index c49ad2adf..716a6b7f3 100644 --- a/examples/wlan/src/bin/tx.rs +++ b/examples/wlan/src/bin/tx.rs @@ -1,7 +1,4 @@ use clap::Parser; -use std::time::Duration; - -use futuresdr::anyhow::Result; use futuresdr::async_io::Timer; use futuresdr::blocks::seify::SinkBuilder; use futuresdr::blocks::Fft; @@ -11,7 +8,9 @@ use futuresdr::runtime::copy_tag_propagation; use futuresdr::runtime::BlockT; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::Runtime; +use std::time::Duration; use wlan::parse_channel; use wlan::Encoder; diff --git a/examples/wlan/src/decoder.rs b/examples/wlan/src/decoder.rs index 576272b88..c00a880c6 100644 --- a/examples/wlan/src/decoder.rs +++ b/examples/wlan/src/decoder.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; @@ -7,6 +6,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; diff --git a/examples/wlan/src/encoder.rs b/examples/wlan/src/encoder.rs index b83506582..574857fd4 100644 --- a/examples/wlan/src/encoder.rs +++ b/examples/wlan/src/encoder.rs @@ -1,9 +1,3 @@ -use crate::FrameParam; -use crate::Mcs; -use crate::MAX_ENCODED_BITS; -use crate::MAX_PSDU_SIZE; - -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::macros::message_handler; use futuresdr::runtime::BlockMeta; @@ -12,6 +6,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; @@ -20,6 +15,11 @@ use futuresdr::runtime::WorkIo; use futuresdr::tracing::warn; use std::collections::VecDeque; +use crate::FrameParam; +use crate::Mcs; +use crate::MAX_ENCODED_BITS; +use crate::MAX_PSDU_SIZE; + /// Maximum number of frames to queue for transmission const MAX_FRAMES: usize = 1000; diff --git a/examples/wlan/src/frame_equalizer.rs b/examples/wlan/src/frame_equalizer.rs index e0a8d0ace..cdc2c2e2f 100644 --- a/examples/wlan/src/frame_equalizer.rs +++ b/examples/wlan/src/frame_equalizer.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::num_complex::Complex32; use futuresdr::runtime::BlockMeta; @@ -8,6 +7,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; diff --git a/examples/wlan/src/mapper.rs b/examples/wlan/src/mapper.rs index 3a71dd670..ee9c0a2fe 100644 --- a/examples/wlan/src/mapper.rs +++ b/examples/wlan/src/mapper.rs @@ -1,8 +1,3 @@ -use crate::FrameParam; -use crate::Modulation; -use crate::POLARITY; - -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::num_complex::Complex32; use futuresdr::runtime::BlockMeta; @@ -11,12 +6,17 @@ use futuresdr::runtime::ItemTag; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; +use crate::FrameParam; +use crate::Modulation; +use crate::POLARITY; + pub struct Mapper { signal: [u8; 24], signal_encoded: [u8; 48], diff --git a/examples/wlan/src/moving_average.rs b/examples/wlan/src/moving_average.rs index b3e0167d0..8d9ee6361 100644 --- a/examples/wlan/src/moving_average.rs +++ b/examples/wlan/src/moving_average.rs @@ -1,6 +1,3 @@ -use std::marker::PhantomData; - -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::num_complex::Complex32; use futuresdr::runtime::BlockMeta; @@ -8,10 +5,12 @@ use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; +use std::marker::PhantomData; const MAX_ITER: usize = 4000; diff --git a/examples/wlan/src/prefix.rs b/examples/wlan/src/prefix.rs index 9449c59ae..676fbe3fd 100644 --- a/examples/wlan/src/prefix.rs +++ b/examples/wlan/src/prefix.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::num_complex::Complex32; use futuresdr::runtime::BlockMeta; @@ -7,6 +6,7 @@ use futuresdr::runtime::ItemTag; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; diff --git a/examples/wlan/src/sync_long.rs b/examples/wlan/src/sync_long.rs index 2c3c458c5..fc5ebba15 100644 --- a/examples/wlan/src/sync_long.rs +++ b/examples/wlan/src/sync_long.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::num_complex::Complex32; use futuresdr::runtime::BlockMeta; @@ -7,6 +6,7 @@ use futuresdr::runtime::ItemTag; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; diff --git a/examples/wlan/src/sync_short.rs b/examples/wlan/src/sync_short.rs index 2db302e7f..d8ae571b4 100644 --- a/examples/wlan/src/sync_short.rs +++ b/examples/wlan/src/sync_short.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::num_complex::Complex32; use futuresdr::runtime::BlockMeta; @@ -6,6 +5,7 @@ use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; diff --git a/examples/wlan/tests/prefix-vs-tags.rs b/examples/wlan/tests/prefix-vs-tags.rs index 56025d8e6..5ba8a6c05 100644 --- a/examples/wlan/tests/prefix-vs-tags.rs +++ b/examples/wlan/tests/prefix-vs-tags.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::blocks::Fft; use futuresdr::blocks::FftDirection; use futuresdr::blocks::MessageBurst; @@ -9,6 +8,7 @@ use futuresdr::runtime::copy_tag_propagation; use futuresdr::runtime::BlockT; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::Runtime; use wlan::Encoder; diff --git a/examples/zeromq/Cargo.toml b/examples/zeromq/Cargo.toml index 916db630f..a1206e294 100644 --- a/examples/zeromq/Cargo.toml +++ b/examples/zeromq/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" futuresdr = { path = "../..", features = ["zeromq"] } [[bin]] diff --git a/examples/zeromq/zmq_receiver.rs b/examples/zeromq/zmq_receiver.rs index 2231650b6..9ec6bd3cf 100644 --- a/examples/zeromq/zmq_receiver.rs +++ b/examples/zeromq/zmq_receiver.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::zeromq::SubSourceBuilder; use futuresdr::blocks::FileSink; use futuresdr::runtime::Flowgraph; diff --git a/examples/zeromq/zmq_sender.rs b/examples/zeromq/zmq_sender.rs index 3c08b20ce..851cdbdae 100644 --- a/examples/zeromq/zmq_sender.rs +++ b/examples/zeromq/zmq_sender.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::zeromq::PubSinkBuilder; use futuresdr::blocks::Head; use futuresdr::blocks::NullSource; diff --git a/examples/zigbee/Cargo.toml b/examples/zigbee/Cargo.toml index 3b3499fab..02021c161 100644 --- a/examples/zigbee/Cargo.toml +++ b/examples/zigbee/Cargo.toml @@ -15,6 +15,7 @@ aaronia_http = ["futuresdr/aaronia_http"] soapy = ["futuresdr/soapy"] [dependencies] +anyhow = "1.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] clap = { version = "4", features = ["derive"] } diff --git a/examples/zigbee/src/bin/rx.rs b/examples/zigbee/src/bin/rx.rs index daa4285fd..9378d816d 100644 --- a/examples/zigbee/src/bin/rx.rs +++ b/examples/zigbee/src/bin/rx.rs @@ -1,5 +1,5 @@ +use anyhow::Result; use clap::Parser; -use futuresdr::anyhow::Result; use futuresdr::blocks::seify::SourceBuilder; use futuresdr::blocks::Apply; use futuresdr::blocks::BlobToUdp; diff --git a/examples/zigbee/src/bin/trx.rs b/examples/zigbee/src/bin/trx.rs index 40290d818..1f58f6009 100644 --- a/examples/zigbee/src/bin/trx.rs +++ b/examples/zigbee/src/bin/trx.rs @@ -1,7 +1,5 @@ +use anyhow::Result; use clap::Parser; -use std::time::Duration; - -use futuresdr::anyhow::Result; use futuresdr::async_io::block_on; use futuresdr::async_io::Timer; use futuresdr::blocks::seify::SinkBuilder; @@ -11,6 +9,7 @@ use futuresdr::num_complex::Complex32; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; use futuresdr::runtime::Runtime; +use std::time::Duration; use zigbee::modulator; use zigbee::parse_channel; diff --git a/examples/zigbee/src/bin/tx.rs b/examples/zigbee/src/bin/tx.rs index 88d1f80db..a7408e990 100644 --- a/examples/zigbee/src/bin/tx.rs +++ b/examples/zigbee/src/bin/tx.rs @@ -1,13 +1,12 @@ +use anyhow::Result; use clap::Parser; -use std::time::Duration; - -use futuresdr::anyhow::Result; use futuresdr::async_io::block_on; use futuresdr::async_io::Timer; use futuresdr::blocks::seify::SinkBuilder; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; use futuresdr::runtime::Runtime; +use std::time::Duration; use zigbee::modulator; use zigbee::parse_channel; diff --git a/examples/zigbee/src/clock_recovery_mm.rs b/examples/zigbee/src/clock_recovery_mm.rs index fa3e16b07..95a898d90 100644 --- a/examples/zigbee/src/clock_recovery_mm.rs +++ b/examples/zigbee/src/clock_recovery_mm.rs @@ -1,10 +1,10 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/zigbee/src/decoder.rs b/examples/zigbee/src/decoder.rs index 3045558d4..5365d99ce 100644 --- a/examples/zigbee/src/decoder.rs +++ b/examples/zigbee/src/decoder.rs @@ -1,4 +1,3 @@ -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; use futuresdr::runtime::BlockMetaBuilder; @@ -6,6 +5,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::TypedBlock; diff --git a/examples/zigbee/src/iq_delay.rs b/examples/zigbee/src/iq_delay.rs index 241bb5649..0a1fa8454 100644 --- a/examples/zigbee/src/iq_delay.rs +++ b/examples/zigbee/src/iq_delay.rs @@ -1,6 +1,3 @@ -use std::collections::VecDeque; - -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::num_complex::Complex32; use futuresdr::runtime::BlockMeta; @@ -9,11 +6,13 @@ use futuresdr::runtime::ItemTag; use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; use futuresdr::runtime::TypedBlock; use futuresdr::runtime::WorkIo; +use std::collections::VecDeque; #[derive(PartialEq, Eq)] enum State { diff --git a/examples/zigbee/src/lib.rs b/examples/zigbee/src/lib.rs index 53670c282..665c84237 100644 --- a/examples/zigbee/src/lib.rs +++ b/examples/zigbee/src/lib.rs @@ -20,8 +20,8 @@ pub mod wasm_gui; #[cfg(target_arch = "wasm32")] pub mod wasm_worker; -use futuresdr::anyhow::bail; -use futuresdr::anyhow::Result; +use anyhow::bail; +use anyhow::Result; pub fn channel_to_freq(chan: u32) -> Result { if (11..=26).contains(&chan) { diff --git a/examples/zigbee/src/mac.rs b/examples/zigbee/src/mac.rs index 8ddcab28d..bc891926f 100644 --- a/examples/zigbee/src/mac.rs +++ b/examples/zigbee/src/mac.rs @@ -1,6 +1,3 @@ -use std::collections::VecDeque; - -use futuresdr::anyhow::Result; use futuresdr::macros::async_trait; use futuresdr::macros::message_handler; use futuresdr::runtime::BlockMeta; @@ -9,6 +6,7 @@ use futuresdr::runtime::Kernel; use futuresdr::runtime::MessageIo; use futuresdr::runtime::MessageIoBuilder; use futuresdr::runtime::Pmt; +use futuresdr::runtime::Result; use futuresdr::runtime::StreamIo; use futuresdr::runtime::StreamIoBuilder; use futuresdr::runtime::Tag; @@ -17,6 +15,7 @@ use futuresdr::runtime::WorkIo; use futuresdr::tracing::debug; use futuresdr::tracing::info; use futuresdr::tracing::warn; +use std::collections::VecDeque; const MAX_FRAMES: usize = 128; const MAX_FRAME_SIZE: usize = 127; diff --git a/examples/zigbee/src/wasm_worker.rs b/examples/zigbee/src/wasm_worker.rs index 9a3365c48..aa2c7cfb0 100644 --- a/examples/zigbee/src/wasm_worker.rs +++ b/examples/zigbee/src/wasm_worker.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::wasm::HackRf; use futuresdr::blocks::Apply; use futuresdr::blocks::MessagePipe; diff --git a/examples/zynq.rs b/examples/zynq.rs index 42536ac33..9644c0e18 100644 --- a/examples/zynq.rs +++ b/examples/zynq.rs @@ -1,6 +1,4 @@ -use rand::Rng; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Copy; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; @@ -10,6 +8,7 @@ use futuresdr::runtime::buffer::zynq::D2H; use futuresdr::runtime::buffer::zynq::H2D; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use rand::Rng; fn main() -> Result<()> { let mut fg = Flowgraph::new(); diff --git a/perf/buffer_rand/Cargo.toml b/perf/buffer_rand/Cargo.toml index f2d8d9543..8e7055055 100644 --- a/perf/buffer_rand/Cargo.toml +++ b/perf/buffer_rand/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features = ["flow_scheduler"] } tracing = { version = "0.1", features = ["release_max_level_off"] } diff --git a/perf/buffer_rand/buffer_rand.rs b/perf/buffer_rand/buffer_rand.rs index 4d721e057..7fed87177 100644 --- a/perf/buffer_rand/buffer_rand.rs +++ b/perf/buffer_rand/buffer_rand.rs @@ -1,8 +1,6 @@ +use anyhow::Context; +use anyhow::Result; use clap::Parser; -use std::time; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; use futuresdr::blocks::CopyRandBuilder; use futuresdr::blocks::Head; use futuresdr::blocks::NullSink; @@ -13,6 +11,7 @@ use futuresdr::runtime::scheduler::SmolScheduler; use futuresdr::runtime::Error; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::time; fn connect( fg: &mut Flowgraph, @@ -21,7 +20,7 @@ fn connect( dst: usize, dst_port: &'static str, slab: bool, -) -> std::result::Result<(), Error> { +) -> Result<(), Error> { if slab { fg.connect_stream_with_type(src, src_port, dst, dst_port, Slab::new()) } else { diff --git a/perf/buffer_size/Cargo.toml b/perf/buffer_size/Cargo.toml index d0d10d2d3..c42bda5a5 100644 --- a/perf/buffer_size/Cargo.toml +++ b/perf/buffer_size/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features = ["flow_scheduler"] } tracing = { version = "0.1", features = ["release_max_level_off"] } diff --git a/perf/buffer_size/buffer_size.rs b/perf/buffer_size/buffer_size.rs index eb48be74f..c3488e876 100644 --- a/perf/buffer_size/buffer_size.rs +++ b/perf/buffer_size/buffer_size.rs @@ -1,8 +1,6 @@ +use anyhow::Context; +use anyhow::Result; use clap::Parser; -use std::time; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; use futuresdr::blocks::CopyRand; use futuresdr::blocks::Head; use futuresdr::blocks::NullSink; @@ -14,6 +12,7 @@ use futuresdr::runtime::scheduler::SmolScheduler; use futuresdr::runtime::Error; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::time; fn connect( fg: &mut Flowgraph, @@ -23,7 +22,7 @@ fn connect( dst_port: &'static str, slab: bool, min_bytes: usize, -) -> std::result::Result<(), Error> { +) -> Result<(), Error> { if slab { fg.connect_stream_with_type(src, src_port, dst, dst_port, Slab::with_size(min_bytes)) } else { diff --git a/perf/fir/Cargo.toml b/perf/fir/Cargo.toml index b7f5b97e4..a9887c8bd 100644 --- a/perf/fir/Cargo.toml +++ b/perf/fir/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features = ["flow_scheduler", "tpb_scheduler"] } rand = "0.8" diff --git a/perf/fir/fir.rs b/perf/fir/fir.rs index 5c55d9312..77be5a65b 100644 --- a/perf/fir/fir.rs +++ b/perf/fir/fir.rs @@ -1,9 +1,6 @@ +use anyhow::Context; +use anyhow::Result; use clap::Parser; -use std::iter::repeat_with; -use std::time; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; use futuresdr::blocks::CopyRandBuilder; use futuresdr::blocks::FirBuilder; use futuresdr::blocks::Head; @@ -14,6 +11,8 @@ use futuresdr::runtime::scheduler::SmolScheduler; use futuresdr::runtime::scheduler::TpbScheduler; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::iter::repeat_with; +use std::time; #[derive(Parser, Debug)] struct Args { diff --git a/perf/fir_latency/Cargo.toml b/perf/fir_latency/Cargo.toml index f75f15031..7bbd8c286 100644 --- a/perf/fir_latency/Cargo.toml +++ b/perf/fir_latency/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features = ["flow_scheduler", "tpb_scheduler", "lttng"] } rand = "0.8" diff --git a/perf/fir_latency/fir.rs b/perf/fir_latency/fir.rs index d041db616..90beb9cfe 100644 --- a/perf/fir_latency/fir.rs +++ b/perf/fir_latency/fir.rs @@ -1,9 +1,6 @@ +use anyhow::Context; +use anyhow::Result; use clap::Parser; -use std::iter::repeat_with; -use std::time; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; use futuresdr::blocks::lttng::NullSink; use futuresdr::blocks::lttng::NullSource; use futuresdr::blocks::CopyRandBuilder; @@ -14,6 +11,8 @@ use futuresdr::runtime::scheduler::SmolScheduler; use futuresdr::runtime::scheduler::TpbScheduler; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::iter::repeat_with; +use std::time; const GRANULARITY: u64 = 32768; diff --git a/perf/msg/Cargo.toml b/perf/msg/Cargo.toml index fee5847be..23a2a3117 100644 --- a/perf/msg/Cargo.toml +++ b/perf/msg/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../.." } tracing = { version = "0.1", features = ["release_max_level_off"] } diff --git a/perf/msg/msg.rs b/perf/msg/msg.rs index 68e98e165..b408ce87a 100644 --- a/perf/msg/msg.rs +++ b/perf/msg/msg.rs @@ -1,13 +1,12 @@ +use anyhow::Result; use clap::Parser; -use std::time; - -use futuresdr::anyhow::Result; use futuresdr::blocks::MessageBurst; use futuresdr::blocks::MessageCopy; use futuresdr::blocks::MessageSink; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Pmt; use futuresdr::runtime::Runtime; +use std::time; #[derive(Parser, Debug)] struct Args { diff --git a/perf/null_rand/Cargo.toml b/perf/null_rand/Cargo.toml index e9e7fd2fc..219e09ca7 100644 --- a/perf/null_rand/Cargo.toml +++ b/perf/null_rand/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features = ["flow_scheduler", "tpb_scheduler"] } tracing = { version = "0.1", features = ["release_max_level_off"] } diff --git a/perf/null_rand/null_rand.rs b/perf/null_rand/null_rand.rs index 43e02f538..d9daa7c8e 100644 --- a/perf/null_rand/null_rand.rs +++ b/perf/null_rand/null_rand.rs @@ -1,8 +1,6 @@ +use anyhow::Context; +use anyhow::Result; use clap::Parser; -use std::time; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; use futuresdr::blocks::CopyRandBuilder; use futuresdr::blocks::Head; use futuresdr::blocks::NullSink; @@ -12,6 +10,7 @@ use futuresdr::runtime::scheduler::SmolScheduler; use futuresdr::runtime::scheduler::TpbScheduler; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::time; #[derive(Parser, Debug)] struct Args { diff --git a/perf/null_rand_latency/Cargo.toml b/perf/null_rand_latency/Cargo.toml index ad0fc2810..62441a566 100644 --- a/perf/null_rand_latency/Cargo.toml +++ b/perf/null_rand_latency/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features = ["flow_scheduler", "tpb_scheduler", "lttng"] } tracing = { version = "0.1", features = ["release_max_level_off"] } diff --git a/perf/null_rand_latency/null_rand_latency.rs b/perf/null_rand_latency/null_rand_latency.rs index a3d3d08b5..06230132d 100644 --- a/perf/null_rand_latency/null_rand_latency.rs +++ b/perf/null_rand_latency/null_rand_latency.rs @@ -1,8 +1,6 @@ +use anyhow::Context; +use anyhow::Result; use clap::Parser; -use std::time; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; use futuresdr::blocks::lttng::NullSink; use futuresdr::blocks::lttng::NullSource; use futuresdr::blocks::CopyRandBuilder; @@ -12,6 +10,7 @@ use futuresdr::runtime::scheduler::SmolScheduler; use futuresdr::runtime::scheduler::TpbScheduler; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::time; const GRANULARITY: u64 = 32768; diff --git a/perf/vulkan/Cargo.toml b/perf/vulkan/Cargo.toml index 2447a64e0..8b6a26cba 100644 --- a/perf/vulkan/Cargo.toml +++ b/perf/vulkan/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features = ["vulkan"] } rand = "0.8" diff --git a/perf/vulkan/vulkan.rs b/perf/vulkan/vulkan.rs index 1d8a36b4d..4064215b3 100644 --- a/perf/vulkan/vulkan.rs +++ b/perf/vulkan/vulkan.rs @@ -1,9 +1,5 @@ +use anyhow::Result; use clap::Parser; -use std::iter::repeat_with; -use std::sync::Arc; -use std::time; - -use futuresdr::anyhow::Result; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSource; use futuresdr::blocks::VulkanBuilder; @@ -12,6 +8,9 @@ use futuresdr::runtime::buffer::vulkan::Broker; use futuresdr::runtime::scheduler::SmolScheduler; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::iter::repeat_with; +use std::sync::Arc; +use std::time; #[derive(Parser, Debug)] struct Args { diff --git a/perf/wgpu/Cargo.toml b/perf/wgpu/Cargo.toml index 42e1de838..7192cab49 100644 --- a/perf/wgpu/Cargo.toml +++ b/perf/wgpu/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] +anyhow = "1.0" futuresdr = { path = "../..", features = ["wgpu"] } rand = "0.8" tracing = { version = "0.1", features = ["release_max_level_off"] } diff --git a/perf/wgpu/src/bin/perf.rs b/perf/wgpu/src/bin/perf.rs index 9fff71e9a..6a002dd07 100644 --- a/perf/wgpu/src/bin/perf.rs +++ b/perf/wgpu/src/bin/perf.rs @@ -1,9 +1,9 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; #[cfg(not(target_arch = "wasm32"))] mod foo { + use anyhow::Result; use clap::Parser; - use futuresdr::anyhow::Result; #[derive(Parser, Debug)] struct Args { @@ -32,7 +32,7 @@ mod foo { #[cfg(target_arch = "wasm32")] mod foo { - use futuresdr::anyhow::Result; + use anyhow::Result; use leptos::*; #[component] diff --git a/perf/wgpu/src/lib.rs b/perf/wgpu/src/lib.rs index 2478a4736..2d58540e4 100644 --- a/perf/wgpu/src/lib.rs +++ b/perf/wgpu/src/lib.rs @@ -1,13 +1,12 @@ -use std::iter::repeat_with; - -use futuresdr::anyhow::Context; -use futuresdr::anyhow::Result; +use anyhow::Context; +use anyhow::Result; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSource; use futuresdr::blocks::Wgpu; use futuresdr::runtime::buffer::wgpu; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::iter::repeat_with; #[cfg(not(target_arch = "wasm32"))] use futuresdr::runtime::scheduler::SmolScheduler; diff --git a/perf/zynq/Cargo.toml b/perf/zynq/Cargo.toml index 637160182..f92c6f9bd 100644 --- a/perf/zynq/Cargo.toml +++ b/perf/zynq/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [workspace] [dependencies] +anyhow = "1.0" clap = { version = "4", features = ["derive"] } futuresdr = { path = "../..", features = ["zynq"] } rand = "0.8" diff --git a/perf/zynq/zynq.rs b/perf/zynq/zynq.rs index 180dd9061..4ac3438e9 100644 --- a/perf/zynq/zynq.rs +++ b/perf/zynq/zynq.rs @@ -1,8 +1,5 @@ +use anyhow::Result; use clap::Parser; -use rand::Rng; -use std::time::Instant; - -use futuresdr::anyhow::Result; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; use futuresdr::blocks::VectorSource; @@ -13,6 +10,8 @@ use futuresdr::runtime::buffer::zynq::H2D; use futuresdr::runtime::Block; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use rand::Rng; +use std::time::Instant; #[derive(Parser, Debug)] struct Args { diff --git a/src/blocks/apply.rs b/src/blocks/apply.rs index 982722f0b..76a9f2be9 100644 --- a/src/blocks/apply.rs +++ b/src/blocks/apply.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/applyintoiter.rs b/src/blocks/applyintoiter.rs index 1920a9107..cf3762468 100644 --- a/src/blocks/applyintoiter.rs +++ b/src/blocks/applyintoiter.rs @@ -1,10 +1,10 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::ItemTag; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/applynm.rs b/src/blocks/applynm.rs index 7746985df..3184ecee3 100644 --- a/src/blocks/applynm.rs +++ b/src/blocks/applynm.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/audio/audio_sink.rs b/src/blocks/audio/audio_sink.rs index cfb95e82a..0b0843c6d 100644 --- a/src/blocks/audio/audio_sink.rs +++ b/src/blocks/audio/audio_sink.rs @@ -9,12 +9,12 @@ use futures::channel::mpsc; use futures::channel::oneshot; use futures::SinkExt; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/audio/audio_source.rs b/src/blocks/audio/audio_source.rs index 445943fa4..f1655ad2c 100644 --- a/src/blocks/audio/audio_source.rs +++ b/src/blocks/audio/audio_source.rs @@ -6,12 +6,12 @@ use cpal::SampleRate; use cpal::Stream; use cpal::StreamConfig; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/audio/file_source.rs b/src/blocks/audio/file_source.rs index 0fc00c7ad..65cb3152e 100644 --- a/src/blocks/audio/file_source.rs +++ b/src/blocks/audio/file_source.rs @@ -5,12 +5,12 @@ use rodio::Decoder; use std::fs::File; use std::io::BufReader; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/audio/wav_sink.rs b/src/blocks/audio/wav_sink.rs index 13aad4d5e..b44391e9a 100644 --- a/src/blocks/audio/wav_sink.rs +++ b/src/blocks/audio/wav_sink.rs @@ -1,11 +1,11 @@ use std::path; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/blob_to_udp.rs b/src/blocks/blob_to_udp.rs index 9ce86dc18..a0fed68dd 100644 --- a/src/blocks/blob_to_udp.rs +++ b/src/blocks/blob_to_udp.rs @@ -2,13 +2,13 @@ use async_net::SocketAddr; use async_net::UdpSocket; use std::net::ToSocketAddrs; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; use crate::runtime::Pmt; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/channel_sink.rs b/src/blocks/channel_sink.rs index bbe976347..ef47e3ada 100644 --- a/src/blocks/channel_sink.rs +++ b/src/blocks/channel_sink.rs @@ -1,10 +1,10 @@ -use crate::anyhow::Result; use crate::futures::channel::mpsc::Sender; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/channel_source.rs b/src/blocks/channel_source.rs index f9c3ebfc9..9332ae00f 100644 --- a/src/blocks/channel_source.rs +++ b/src/blocks/channel_source.rs @@ -1,12 +1,12 @@ use crate::futures::channel::mpsc::Receiver; use crate::futures::StreamExt; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/combine.rs b/src/blocks/combine.rs index d4763e870..94780f3fe 100644 --- a/src/blocks/combine.rs +++ b/src/blocks/combine.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/console_sink.rs b/src/blocks/console_sink.rs index aad239836..84ca75802 100644 --- a/src/blocks/console_sink.rs +++ b/src/blocks/console_sink.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/copy.rs b/src/blocks/copy.rs index 94d42c622..35c01840b 100644 --- a/src/blocks/copy.rs +++ b/src/blocks/copy.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/copy_rand.rs b/src/blocks/copy_rand.rs index 8bca18a60..b7c142acc 100644 --- a/src/blocks/copy_rand.rs +++ b/src/blocks/copy_rand.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/delay.rs b/src/blocks/delay.rs index 9f0aea664..d23b43303 100644 --- a/src/blocks/delay.rs +++ b/src/blocks/delay.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/fft.rs b/src/blocks/fft.rs index 262a99905..f4f2ee933 100644 --- a/src/blocks/fft.rs +++ b/src/blocks/fft.rs @@ -3,13 +3,13 @@ use rustfft::FftPlanner; use std::cmp; use std::sync::Arc; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; use crate::runtime::Pmt; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/file_sink.rs b/src/blocks/file_sink.rs index e58477fc1..bdbaedb8b 100644 --- a/src/blocks/file_sink.rs +++ b/src/blocks/file_sink.rs @@ -2,12 +2,12 @@ use async_fs::File; use futures::io::AsyncWriteExt; use std::fs::OpenOptions; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/file_source.rs b/src/blocks/file_source.rs index 28468225c..0a5ef0ed5 100644 --- a/src/blocks/file_source.rs +++ b/src/blocks/file_source.rs @@ -1,11 +1,11 @@ use futures::AsyncReadExt; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/filter.rs b/src/blocks/filter.rs index 2f6c9d9c7..4963e70a7 100644 --- a/src/blocks/filter.rs +++ b/src/blocks/filter.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/finite_source.rs b/src/blocks/finite_source.rs index a777201ad..b955342a7 100644 --- a/src/blocks/finite_source.rs +++ b/src/blocks/finite_source.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/fir.rs b/src/blocks/fir.rs index 6e8063da7..c16da6b88 100644 --- a/src/blocks/fir.rs +++ b/src/blocks/fir.rs @@ -10,12 +10,12 @@ use num_traits::Num; use std::iter::Sum; use std::ops::Mul; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/head.rs b/src/blocks/head.rs index 0dcd3b651..a15c92497 100644 --- a/src/blocks/head.rs +++ b/src/blocks/head.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/iir.rs b/src/blocks/iir.rs index 447c4370b..be7adcd46 100644 --- a/src/blocks/iir.rs +++ b/src/blocks/iir.rs @@ -3,12 +3,12 @@ use futuredsp::prelude::*; use futuredsp::ComputationStatus; use futuredsp::IirFilter; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/lttng/null_sink.rs b/src/blocks/lttng/null_sink.rs index 052b072ff..a198ed439 100644 --- a/src/blocks/lttng/null_sink.rs +++ b/src/blocks/lttng/null_sink.rs @@ -1,11 +1,11 @@ use lttng_ust::import_tracepoints; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/lttng/null_source.rs b/src/blocks/lttng/null_source.rs index 3370f926b..007cc11e7 100644 --- a/src/blocks/lttng/null_source.rs +++ b/src/blocks/lttng/null_source.rs @@ -1,12 +1,12 @@ use lttng_ust::import_tracepoints; use std::ptr; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/message_burst.rs b/src/blocks/message_burst.rs index 9d7c1e933..0093afbc0 100644 --- a/src/blocks/message_burst.rs +++ b/src/blocks/message_burst.rs @@ -1,10 +1,10 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; use crate::runtime::Pmt; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/message_sink.rs b/src/blocks/message_sink.rs index 71221c321..7a40dab48 100644 --- a/src/blocks/message_sink.rs +++ b/src/blocks/message_sink.rs @@ -1,10 +1,10 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; use crate::runtime::Pmt; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/message_source.rs b/src/blocks/message_source.rs index df9d4ae89..85411a05e 100644 --- a/src/blocks/message_source.rs +++ b/src/blocks/message_source.rs @@ -2,13 +2,13 @@ use async_io::Timer; use std::time::Duration; use web_time::Instant; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; use crate::runtime::Pmt; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/moving_avg.rs b/src/blocks/moving_avg.rs index a62b1313c..c558c6870 100644 --- a/src/blocks/moving_avg.rs +++ b/src/blocks/moving_avg.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/null_sink.rs b/src/blocks/null_sink.rs index c3c4d8d4a..70b7c8e00 100644 --- a/src/blocks/null_sink.rs +++ b/src/blocks/null_sink.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/null_source.rs b/src/blocks/null_source.rs index bc578b4c8..01b56bba7 100644 --- a/src/blocks/null_source.rs +++ b/src/blocks/null_source.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/pfb/arb_resampler.rs b/src/blocks/pfb/arb_resampler.rs index cb40a6665..a82cdf32e 100644 --- a/src/blocks/pfb/arb_resampler.rs +++ b/src/blocks/pfb/arb_resampler.rs @@ -1,4 +1,3 @@ -use anyhow::Result; use futuredsp::prelude::*; use futuredsp::FirFilter; use num_complex::Complex32; @@ -9,6 +8,7 @@ use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/pfb/channelizer.rs b/src/blocks/pfb/channelizer.rs index 1b2b086e1..0956bfb90 100644 --- a/src/blocks/pfb/channelizer.rs +++ b/src/blocks/pfb/channelizer.rs @@ -7,13 +7,13 @@ use rustfft::FftPlanner; use std::cmp::min; use std::sync::Arc; -use crate::anyhow::Result; use crate::num_complex::Complex32; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/pfb/synthesizer.rs b/src/blocks/pfb/synthesizer.rs index f6b5eacff..fb21e12f9 100644 --- a/src/blocks/pfb/synthesizer.rs +++ b/src/blocks/pfb/synthesizer.rs @@ -6,13 +6,13 @@ use rustfft::FftPlanner; use std::cmp::min; use std::sync::Arc; -use crate::anyhow::Result; use crate::num_complex::Complex32; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/seify/sink.rs b/src/blocks/seify/sink.rs index c4f571af6..0c129ac5f 100644 --- a/src/blocks/seify/sink.rs +++ b/src/blocks/seify/sink.rs @@ -5,18 +5,18 @@ use seify::GenericDevice; use seify::TxStreamer; use std::time::Duration; -use crate::anyhow::Context; -use crate::anyhow::Result; use crate::blocks::seify::Builder; use crate::blocks::seify::Config; use crate::num_complex::Complex32; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; +use crate::runtime::Error; use crate::runtime::ItemTag; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; use crate::runtime::Pmt; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::Tag; @@ -272,7 +272,7 @@ impl Kernel for Sink { self.streamer = Some(self.dev.tx_streamer(&self.channels)?); self.streamer .as_mut() - .context("no stream")? + .ok_or(Error::RuntimeError("Seify: no streamer".to_string()))? .activate_at(self.start_time)?; Ok(()) @@ -284,7 +284,10 @@ impl Kernel for Sink { _mio: &mut MessageIo, _meta: &mut BlockMeta, ) -> Result<()> { - self.streamer.as_mut().context("no stream")?.deactivate()?; + self.streamer + .as_mut() + .ok_or(Error::RuntimeError("Seify: no streamer".to_string()))? + .deactivate()?; Ok(()) } } diff --git a/src/blocks/seify/source.rs b/src/blocks/seify/source.rs index f2137a1b2..e0f3a34e0 100644 --- a/src/blocks/seify/source.rs +++ b/src/blocks/seify/source.rs @@ -1,3 +1,4 @@ +use anyhow::Context; use seify::Device; use seify::DeviceTrait; use seify::Direction::Rx; @@ -5,8 +6,6 @@ use seify::GenericDevice; use seify::RxStreamer; use std::time::Duration; -use crate::anyhow::Context; -use crate::anyhow::Result; use crate::blocks::seify::builder::BuilderType; use crate::blocks::seify::Builder; use crate::blocks::seify::Config; @@ -17,6 +16,7 @@ use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; use crate::runtime::Pmt; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/selector.rs b/src/blocks/selector.rs index 7e2f16664..47de9c97b 100644 --- a/src/blocks/selector.rs +++ b/src/blocks/selector.rs @@ -3,13 +3,13 @@ use std::fmt; use std::ptr; use std::str::FromStr; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; use crate::runtime::Pmt; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/signal_source/mod.rs b/src/blocks/signal_source/mod.rs index 18e74a8a2..cedc1b74f 100644 --- a/src/blocks/signal_source/mod.rs +++ b/src/blocks/signal_source/mod.rs @@ -1,5 +1,4 @@ //! SignalSource using Lookup Tables -use crate::anyhow::Result; use crate::num_complex::Complex32; use crate::runtime::Block; use crate::runtime::BlockMeta; @@ -7,6 +6,7 @@ use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/sink.rs b/src/blocks/sink.rs index 8cfd0beac..c575f2ce4 100644 --- a/src/blocks/sink.rs +++ b/src/blocks/sink.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/source.rs b/src/blocks/source.rs index 7dd23379b..f8c3531fb 100644 --- a/src/blocks/source.rs +++ b/src/blocks/source.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/split.rs b/src/blocks/split.rs index 50e70b291..9fe385603 100644 --- a/src/blocks/split.rs +++ b/src/blocks/split.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/stream_deinterleaver.rs b/src/blocks/stream_deinterleaver.rs index 3e4601a95..c75d620b2 100644 --- a/src/blocks/stream_deinterleaver.rs +++ b/src/blocks/stream_deinterleaver.rs @@ -1,12 +1,12 @@ use std::cmp::min; use std::marker::PhantomData; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/stream_duplicator.rs b/src/blocks/stream_duplicator.rs index 49ff3d5ed..423bf7432 100644 --- a/src/blocks/stream_duplicator.rs +++ b/src/blocks/stream_duplicator.rs @@ -1,12 +1,12 @@ use std::cmp::min; use std::marker::PhantomData; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/tag_debug.rs b/src/blocks/tag_debug.rs index d2ec69121..c8894a12a 100644 --- a/src/blocks/tag_debug.rs +++ b/src/blocks/tag_debug.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/tcp_sink.rs b/src/blocks/tcp_sink.rs index 7086acf88..4f445e4ae 100644 --- a/src/blocks/tcp_sink.rs +++ b/src/blocks/tcp_sink.rs @@ -1,15 +1,15 @@ +use anyhow::bail; +use anyhow::Context; use async_net::TcpListener; use async_net::TcpStream; use futures::AsyncWriteExt; -use crate::anyhow::bail; -use crate::anyhow::Context; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/tcp_source.rs b/src/blocks/tcp_source.rs index 5a32689bd..85b301913 100644 --- a/src/blocks/tcp_source.rs +++ b/src/blocks/tcp_source.rs @@ -1,14 +1,14 @@ +use anyhow::Context; use async_net::TcpListener; use async_net::TcpStream; use futures::AsyncReadExt; -use crate::anyhow::Context; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/throttle.rs b/src/blocks/throttle.rs index 3f86bcc02..729e7abaf 100644 --- a/src/blocks/throttle.rs +++ b/src/blocks/throttle.rs @@ -1,11 +1,11 @@ use web_time::Instant; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/udp_source.rs b/src/blocks/udp_source.rs index af2709e0c..0d4d4859c 100644 --- a/src/blocks/udp_source.rs +++ b/src/blocks/udp_source.rs @@ -1,12 +1,12 @@ +use anyhow::Context; use async_net::UdpSocket; -use crate::anyhow::Context; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/vector_sink.rs b/src/blocks/vector_sink.rs index 51ffdc8b8..e6720f7fa 100644 --- a/src/blocks/vector_sink.rs +++ b/src/blocks/vector_sink.rs @@ -1,11 +1,11 @@ use std::marker::PhantomData; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/vector_source.rs b/src/blocks/vector_source.rs index 1f1e6247d..83ba383d1 100644 --- a/src/blocks/vector_source.rs +++ b/src/blocks/vector_source.rs @@ -1,12 +1,12 @@ use std::cmp; use std::ptr; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/vulkan.rs b/src/blocks/vulkan.rs index 1b41014f2..c3c86d269 100644 --- a/src/blocks/vulkan.rs +++ b/src/blocks/vulkan.rs @@ -1,3 +1,4 @@ +use anyhow::Context; use std::sync::Arc; use vulkano::buffer::Buffer; use vulkano::buffer::BufferCreateInfo; @@ -22,8 +23,6 @@ use vulkano::pipeline::PipelineShaderStageCreateInfo; use vulkano::sync::GpuFuture; use vulkano::sync::{self}; -use crate::anyhow::Context; -use crate::anyhow::Result; use crate::runtime::buffer::vulkan::Broker; use crate::runtime::buffer::vulkan::BufferEmpty; use crate::runtime::buffer::vulkan::ReaderH2D; @@ -34,6 +33,7 @@ use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/wasm/hack_rf.rs b/src/blocks/wasm/hack_rf.rs index f0abfacb8..ee07ea1b9 100644 --- a/src/blocks/wasm/hack_rf.rs +++ b/src/blocks/wasm/hack_rf.rs @@ -4,7 +4,6 @@ use wasm_bindgen::prelude::*; use wasm_bindgen_futures::JsFuture; use web_sys::WorkerGlobalScope; -use crate::anyhow::Result; use crate::num_complex::Complex32; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; @@ -12,6 +11,7 @@ use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; use crate::runtime::Pmt; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/wasm/wasm_ws_sink.rs b/src/blocks/wasm/wasm_ws_sink.rs index 92e260c8a..56ba0e70e 100644 --- a/src/blocks/wasm/wasm_ws_sink.rs +++ b/src/blocks/wasm/wasm_ws_sink.rs @@ -12,12 +12,12 @@ use std::sync::Arc; use std::sync::RwLock; use wasm_bindgen_futures::spawn_local; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/websocket_pmt_sink.rs b/src/blocks/websocket_pmt_sink.rs index 2f0b0dc43..cd05c5326 100644 --- a/src/blocks/websocket_pmt_sink.rs +++ b/src/blocks/websocket_pmt_sink.rs @@ -15,14 +15,14 @@ use std::sync::Arc; use std::task::Context; use std::task::Poll; -use crate::anyhow::Context as _; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; +use crate::runtime::Error; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; use crate::runtime::Pmt; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; @@ -142,7 +142,12 @@ impl Kernel for WebsocketPmtSink { }; if let Some(msg) = msg { - let acc = Box::pin(self.listener.as_ref().context("no listener")?.accept()); + let acc = Box::pin( + self.listener + .as_ref() + .ok_or_else(|| Error::RuntimeError("no listener".to_string()))? + .accept(), + ); let send = conn.send(msg); match future::select(acc, send).await { @@ -168,7 +173,7 @@ impl Kernel for WebsocketPmtSink { } else if let Ok((stream, socket)) = self .listener .as_ref() - .context("no listener")? + .ok_or_else(|| Error::RuntimeError("no listener".to_string()))? .get_ref() .accept() { diff --git a/src/blocks/websocket_sink.rs b/src/blocks/websocket_sink.rs index 08f4370ce..68b551edc 100644 --- a/src/blocks/websocket_sink.rs +++ b/src/blocks/websocket_sink.rs @@ -16,13 +16,13 @@ use std::sync::Arc; use std::task::Context; use std::task::Poll; -use crate::anyhow::Context as _; -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; +use crate::runtime::Error; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; @@ -115,7 +115,12 @@ impl Kernel for WebsocketSink { } if !v.is_empty() { - let acc = Box::pin(self.listener.as_ref().context("no listener")?.accept()); + let acc = Box::pin( + self.listener + .as_ref() + .ok_or_else(|| Error::RuntimeError("no listener".to_string()))? + .accept(), + ); let send = conn.send(Message::Binary(v)); match future::select(acc, send).await { @@ -137,7 +142,7 @@ impl Kernel for WebsocketSink { } else if let Ok((stream, socket)) = self .listener .as_ref() - .context("no listener")? + .ok_or_else(|| Error::RuntimeError("no listener".to_string()))? .get_ref() .accept() { diff --git a/src/blocks/wgpu.rs b/src/blocks/wgpu.rs index b7cf400f0..8dd70ccd9 100644 --- a/src/blocks/wgpu.rs +++ b/src/blocks/wgpu.rs @@ -14,7 +14,6 @@ use ::wgpu::ShaderModuleDescriptor; use ::wgpu::ShaderSource; use std::borrow::Cow; -use crate::anyhow::Result; use crate::runtime::buffer::wgpu; use crate::runtime::buffer::BufferReaderCustom; use crate::runtime::BlockMeta; @@ -22,6 +21,7 @@ use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/xlating_fir.rs b/src/blocks/xlating_fir.rs index 44c131e3d..4855489a8 100644 --- a/src/blocks/xlating_fir.rs +++ b/src/blocks/xlating_fir.rs @@ -4,13 +4,13 @@ use futuredsp::prelude::*; use futuredsp::DecimatingFirFilter; use futuredsp::Rotator; -use crate::anyhow::Result; use crate::num_complex::Complex32; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/zeromq/pub_sink.rs b/src/blocks/zeromq/pub_sink.rs index 28bea0b17..03f2a4ab0 100644 --- a/src/blocks/zeromq/pub_sink.rs +++ b/src/blocks/zeromq/pub_sink.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/zeromq/sub_source.rs b/src/blocks/zeromq/sub_source.rs index d5c592cda..dfa0251dd 100644 --- a/src/blocks/zeromq/sub_source.rs +++ b/src/blocks/zeromq/sub_source.rs @@ -1,9 +1,9 @@ -use crate::anyhow::Result; use crate::runtime::BlockMeta; use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/zynq.rs b/src/blocks/zynq.rs index 16353622e..37ae549f5 100644 --- a/src/blocks/zynq.rs +++ b/src/blocks/zynq.rs @@ -2,7 +2,6 @@ use std::marker::PhantomData; use xilinx_dma::AxiDmaAsync; use xilinx_dma::DmaBuffer; -use crate::anyhow::Result; use crate::runtime::buffer::zynq::BufferEmpty; use crate::runtime::buffer::zynq::BufferFull; use crate::runtime::buffer::zynq::ReaderH2D; @@ -12,6 +11,7 @@ use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/blocks/zynq_sync.rs b/src/blocks/zynq_sync.rs index efd063ed3..bb4084d0d 100644 --- a/src/blocks/zynq_sync.rs +++ b/src/blocks/zynq_sync.rs @@ -2,7 +2,6 @@ use std::marker::PhantomData; use xilinx_dma::AxiDma; use xilinx_dma::DmaBuffer; -use crate::anyhow::Result; use crate::runtime::buffer::zynq::BufferEmpty; use crate::runtime::buffer::zynq::BufferFull; use crate::runtime::buffer::zynq::ReaderH2D; @@ -12,6 +11,7 @@ use crate::runtime::BlockMetaBuilder; use crate::runtime::Kernel; use crate::runtime::MessageIo; use crate::runtime::MessageIoBuilder; +use crate::runtime::Result; use crate::runtime::StreamIo; use crate::runtime::StreamIoBuilder; use crate::runtime::TypedBlock; diff --git a/src/lib.rs b/src/lib.rs index 9fa1300c3..dc7aabd6f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,15 +12,15 @@ //! ## Example //! An example flowgraph that forwards 123 zeros into a sink: //! ``` -//! use futuresdr::anyhow::Result; //! use futuresdr::blocks::Head; //! use futuresdr::blocks::NullSink; //! use futuresdr::blocks::NullSource; //! use futuresdr::macros::connect; +//! use futuresdr::runtime::Error; //! use futuresdr::runtime::Flowgraph; //! use futuresdr::runtime::Runtime; //! -//! fn main() -> Result<()> { +//! fn main() -> Result<(), Error> { //! let mut fg = Flowgraph::new(); //! //! let src = NullSource::::new(); @@ -42,7 +42,6 @@ extern crate futuresdr_macros; pub extern crate tracing; // re-exports -pub use anyhow; #[cfg(not(target_arch = "wasm32"))] pub use async_io; #[cfg(not(target_arch = "wasm32"))] diff --git a/src/runtime/block.rs b/src/runtime/block.rs index 030c30441..1b548b010 100644 --- a/src/runtime/block.rs +++ b/src/runtime/block.rs @@ -20,6 +20,7 @@ use crate::runtime::MessageIo; use crate::runtime::MessageOutput; use crate::runtime::Pmt; use crate::runtime::PortId; +use crate::runtime::Result; use crate::runtime::StreamInput; use crate::runtime::StreamIo; use crate::runtime::StreamOutput; @@ -76,7 +77,7 @@ pub trait Kernel: Send { _s: &mut StreamIo, _m: &mut MessageIo, _b: &mut BlockMeta, - ) -> anyhow::Result<()> { + ) -> Result<()> { Ok(()) } /// Initialize kernel @@ -85,7 +86,7 @@ pub trait Kernel: Send { _s: &mut StreamIo, _m: &mut MessageIo, _b: &mut BlockMeta, - ) -> anyhow::Result<()> { + ) -> Result<()> { Ok(()) } /// De-initialize kernel @@ -94,7 +95,7 @@ pub trait Kernel: Send { _s: &mut StreamIo, _m: &mut MessageIo, _b: &mut BlockMeta, - ) -> anyhow::Result<()> { + ) -> Result<()> { Ok(()) } } @@ -186,7 +187,7 @@ impl TypedBlock { kernel: &mut T, id: PortId, p: Pmt, - ) -> std::result::Result { + ) -> Result { let id = match id { PortId::Index(i) => { if i < mio.inputs().len() { diff --git a/src/runtime/message_io.rs b/src/runtime/message_io.rs index 7b395019b..2617fdc16 100644 --- a/src/runtime/message_io.rs +++ b/src/runtime/message_io.rs @@ -4,11 +4,11 @@ use futures::prelude::*; use std::pin::Pin; use std::sync::Arc; -use crate::anyhow::Result; use crate::runtime::BlockMessage; use crate::runtime::BlockMeta; use crate::runtime::Pmt; use crate::runtime::PortId; +use crate::runtime::Result; use crate::runtime::WorkIo; #[cfg(not(target_arch = "wasm32"))] diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs index 0003f68a1..c30698d4a 100644 --- a/src/runtime/mod.rs +++ b/src/runtime/mod.rs @@ -6,7 +6,6 @@ use futuresdr_types::PmtConversionError; use std::fmt; use std::fmt::Display; use std::fmt::Formatter; -use std::result; use thiserror::Error; mod block; @@ -75,6 +74,11 @@ pub use futuresdr_types::PortId; use buffer::BufferReader; use buffer::BufferWriter; +/// Generic Result Type used for the [`Kernel`] trait. +/// +/// At the moment, a type alias for [`anyhow::Result`]. +pub type Result = anyhow::Result; + /// Initialize runtime /// /// This function does not have to be called. Once a [`Runtime`] is started, @@ -117,7 +121,7 @@ pub enum FlowgraphMessage { /// Input data data: Pmt, /// Back channel for result - tx: oneshot::Sender>, + tx: oneshot::Sender>, }, /// Call handler of block BlockCallback { @@ -128,7 +132,7 @@ pub enum FlowgraphMessage { /// Input data data: Pmt, /// Back channel for result - tx: oneshot::Sender>, + tx: oneshot::Sender>, }, /// Get [`FlowgraphDescription`] FlowgraphDescription { @@ -140,7 +144,7 @@ pub enum FlowgraphMessage { /// Block Id block_id: usize, /// Back channel for result - tx: oneshot::Sender>, + tx: oneshot::Sender>, }, } @@ -205,7 +209,7 @@ pub enum BlockMessage { /// [`Pmt`] input data data: Pmt, /// Back channel for handler result - tx: oneshot::Sender>, + tx: oneshot::Sender>, }, } diff --git a/tests/apply.rs b/tests/apply.rs index 97e6cca7a..26adc3b9b 100644 --- a/tests/apply.rs +++ b/tests/apply.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Apply; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; diff --git a/tests/applyintoiter.rs b/tests/applyintoiter.rs index 9c589cbe0..63270fc93 100644 --- a/tests/applyintoiter.rs +++ b/tests/applyintoiter.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::ApplyIntoIter; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; diff --git a/tests/bad_block.rs b/tests/bad_block.rs index f04cc1525..befd8f3d7 100644 --- a/tests/bad_block.rs +++ b/tests/bad_block.rs @@ -1,5 +1,5 @@ -use futuresdr::anyhow::bail; -use futuresdr::anyhow::Result; +use anyhow::bail; +use anyhow::Result; use futuresdr::async_io::block_on; use futuresdr::blocks::Head; use futuresdr::blocks::NullSink; diff --git a/tests/channel_source.rs b/tests/channel_source.rs index f6fa9c0a0..05383c430 100644 --- a/tests/channel_source.rs +++ b/tests/channel_source.rs @@ -1,5 +1,5 @@ -use futuresdr::anyhow::anyhow; -use futuresdr::anyhow::Result; +use anyhow::anyhow; +use anyhow::Result; use futuresdr::async_io::block_on; use futuresdr::blocks::ChannelSource; use futuresdr::blocks::VectorSink; diff --git a/tests/combine.rs b/tests/combine.rs index c72c62e7a..6fc9b13a2 100644 --- a/tests/combine.rs +++ b/tests/combine.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Combine; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; diff --git a/tests/connect_error.rs b/tests/connect_error.rs index f6e50c88a..b2706c41b 100644 --- a/tests/connect_error.rs +++ b/tests/connect_error.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Fft; use futuresdr::blocks::MessageSink; use futuresdr::blocks::MessageSource; diff --git a/tests/fail.rs b/tests/fail.rs index 8e9686000..275c99e48 100644 --- a/tests/fail.rs +++ b/tests/fail.rs @@ -1,5 +1,5 @@ -use futuresdr::anyhow::bail; -use futuresdr::anyhow::Result; +use anyhow::bail; +use anyhow::Result; use futuresdr::blocks::MessageSink; use futuresdr::macros::async_trait; use futuresdr::runtime::BlockMeta; diff --git a/tests/filter.rs b/tests/filter.rs index fc70d03de..3dfac1468 100644 --- a/tests/filter.rs +++ b/tests/filter.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Filter; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; diff --git a/tests/finite_source.rs b/tests/finite_source.rs index 8e04b2ef8..18c39b5df 100644 --- a/tests/finite_source.rs +++ b/tests/finite_source.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::FiniteSource; use futuresdr::blocks::Head; use futuresdr::blocks::VectorSink; diff --git a/tests/fir.rs b/tests/fir.rs index 08dae5d8f..5e3e7bfc0 100644 --- a/tests/fir.rs +++ b/tests/fir.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::FirBuilder; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; diff --git a/tests/flow.rs b/tests/flow.rs index e934ecb00..1d17edbab 100644 --- a/tests/flow.rs +++ b/tests/flow.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Copy; use futuresdr::blocks::Head; use futuresdr::blocks::NullSink; diff --git a/tests/mocker.rs b/tests/mocker.rs index b1b8ee951..9a0a9e750 100644 --- a/tests/mocker.rs +++ b/tests/mocker.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Apply; use futuresdr::blocks::MessageCopy; use futuresdr::runtime::copy_tag_propagation; diff --git a/tests/runtime.rs b/tests/runtime.rs index a604d85c9..7d2b1c66e 100644 --- a/tests/runtime.rs +++ b/tests/runtime.rs @@ -1,6 +1,4 @@ -use std::iter::repeat_with; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::async_io::block_on; use futuresdr::blocks::Copy; use futuresdr::blocks::Head; @@ -12,6 +10,7 @@ use futuresdr::blocks::VectorSinkBuilder; use futuresdr::blocks::VectorSource; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::iter::repeat_with; #[test] fn flowgraph() -> Result<()> { diff --git a/tests/seify.rs b/tests/seify.rs index 7a875a30e..163aac6f3 100644 --- a/tests/seify.rs +++ b/tests/seify.rs @@ -1,6 +1,6 @@ use anyhow::Context; +use anyhow::Result; use float_cmp::assert_approx_eq; -use futuresdr::anyhow::Result; use futuresdr::async_io::block_on; use futuresdr::blocks::seify::*; use futuresdr::blocks::Head; diff --git a/tests/slab.rs b/tests/slab.rs index 74e5b4021..d106bd760 100644 --- a/tests/slab.rs +++ b/tests/slab.rs @@ -1,6 +1,4 @@ -use std::iter::repeat_with; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Copy; use futuresdr::blocks::Head; use futuresdr::blocks::NullSource; @@ -10,6 +8,7 @@ use futuresdr::blocks::VectorSource; use futuresdr::runtime::buffer::slab::Slab; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::iter::repeat_with; #[test] fn flowgraph() -> Result<()> { diff --git a/tests/source.rs b/tests/source.rs index de92b041b..55154403f 100644 --- a/tests/source.rs +++ b/tests/source.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Head; use futuresdr::blocks::Source; use futuresdr::blocks::VectorSink; diff --git a/tests/split.rs b/tests/split.rs index 78378ac19..367bc8b47 100644 --- a/tests/split.rs +++ b/tests/split.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Split; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; diff --git a/tests/tag.rs b/tests/tag.rs index c8a899e03..15644cc6b 100644 --- a/tests/tag.rs +++ b/tests/tag.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::runtime::Tag; #[test] diff --git a/tests/tpb.rs b/tests/tpb.rs index ece7e2ffc..2ba18bd23 100644 --- a/tests/tpb.rs +++ b/tests/tpb.rs @@ -1,4 +1,4 @@ -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::Copy; use futuresdr::blocks::Head; use futuresdr::blocks::NullSource; diff --git a/tests/vulkan.rs b/tests/vulkan.rs index 775749aa8..24755a15c 100644 --- a/tests/vulkan.rs +++ b/tests/vulkan.rs @@ -1,7 +1,4 @@ -use std::iter::repeat_with; -use std::sync::Arc; - -use futuresdr::anyhow::Result; +use anyhow::Result; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; use futuresdr::blocks::VectorSource; @@ -10,6 +7,8 @@ use futuresdr::runtime::buffer::vulkan; use futuresdr::runtime::buffer::vulkan::Broker; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; +use std::iter::repeat_with; +use std::sync::Arc; #[test] fn fg_vulkan() -> Result<()> {