Skip to content

Commit 0b32021

Browse files
committed
fix: export only the necessary types from root crate
1 parent c0ed646 commit 0b32021

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

examples/sync_from_latest_scanning/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use alloy::{network::Ethereum, providers::ProviderBuilder, sol, sol_types::SolEvent};
22
use alloy_node_bindings::Anvil;
3-
use event_scanner::{
4-
EventFilter,
5-
event_scanner::{EventScannerBuilder, Message},
6-
};
3+
use event_scanner::{EventFilter, EventScannerBuilder, Message};
74

85
use tokio_stream::StreamExt;
96
use tracing::{error, info};

src/event_scanner/scanner.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ impl EventScannerBuilder<Unspecified> {
212212
///
213213
/// This method returns a builder that must be further narrowed down:
214214
/// ```rust,no_run
215+
/// # use event_scanner::EventScannerBuilder;
215216
/// // Sync from block mode
216217
/// EventScannerBuilder::sync().from_block(1_000_000);
217218
/// // Sync from latest events mode

src/event_scanner/scanner/sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ impl EventScannerBuilder<Synchronize> {
2525
///
2626
/// ```no_run
2727
/// # use alloy::network::Ethereum;
28-
/// # use event_scanner::{EventFilter, EventScanner, Message};
28+
/// # use event_scanner::{EventFilter, EventScannerBuilder, Message};
2929
/// # use tokio_stream::StreamExt;
3030
/// #
3131
/// # async fn example() -> Result<(), Box<dyn std::error::Error>> {
3232
/// # let ws_url = "ws://localhost:8545".parse()?;
3333
/// # let contract_address = alloy::primitives::address!("0xd8dA6BF26964af9d7eed9e03e53415d37aa96045");
3434
/// // Fetch the latest 10 events, then stream new events continuously
35-
/// let mut scanner = EventScanner::sync()
35+
/// let mut scanner = EventScannerBuilder::sync()
3636
/// .from_latest(10)
3737
/// .connect_ws::<Ethereum>(ws_url)
3838
/// .await?;

src/lib.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
pub mod block_range_scanner;
2-
pub mod error;
3-
pub mod event_scanner;
2+
43
#[cfg(any(test, feature = "test-utils"))]
54
pub mod test_utils;
6-
pub mod types;
5+
6+
mod error;
7+
mod event_scanner;
8+
mod types;
79

810
pub use error::ScannerError;
911
pub use types::{ScannerMessage, ScannerStatus};
1012

11-
pub use event_scanner::{EventFilter, EventScannerBuilder, Message};
13+
pub use event_scanner::{
14+
EventFilter, EventScanner, EventScannerBuilder, Historic, LatestEvents, Live, Message,
15+
SyncFromBlock, SyncFromLatestEvents,
16+
};

tests/common.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ use alloy::{
1515
};
1616
use alloy_node_bindings::{Anvil, AnvilInstance};
1717
use event_scanner::{
18-
EventFilter, EventScannerBuilder, Message,
19-
event_scanner::{
20-
EventScanner, Historic, LatestEvents, Live, SyncFromBlock, SyncFromLatestEvents,
21-
},
22-
test_utils::LogMetadata,
18+
EventFilter, EventScanner, EventScannerBuilder, Historic, LatestEvents, Live, Message,
19+
SyncFromBlock, SyncFromLatestEvents, test_utils::LogMetadata,
2320
};
2421
use tokio_stream::wrappers::ReceiverStream;
2522

tests/historic_to_live/basic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use alloy::{eips::BlockNumberOrTag, primitives::U256};
2-
use event_scanner::{assert_next, types::ScannerStatus};
2+
use event_scanner::{ScannerStatus, assert_next};
33

44
use crate::common::{TestCounter, setup_sync_scanner};
55

tests/historic_to_live/from_latest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use alloy::providers::ext::AnvilApi;
22

33
use crate::common::{TestCounter, TestCounterExt, setup_sync_from_latest_scanner};
4-
use event_scanner::{assert_next, test_utils::LogMetadata, types::ScannerStatus};
4+
use event_scanner::{ScannerStatus, assert_next, test_utils::LogMetadata};
55

66
#[tokio::test]
77
async fn scan_latest_then_live_happy_path_no_duplicates() -> anyhow::Result<()> {

tests/historic_to_live/reorg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{sync::Arc, time::Duration};
22

33
use alloy::{eips::BlockNumberOrTag, providers::ext::AnvilApi};
4-
use event_scanner::{Message, types::ScannerStatus};
4+
use event_scanner::{Message, ScannerStatus};
55
use tokio::{sync::Mutex, time::timeout};
66
use tokio_stream::StreamExt;
77

0 commit comments

Comments
 (0)