Fix bip158 example formatting

This commit is contained in:
Roman Zeyde 2021-02-17 22:35:13 +02:00
parent 052aaf1d80
commit 60e51ada36
1 changed files with 19 additions and 18 deletions

View File

@ -23,25 +23,26 @@
//! The filter construction proposed is an alternative to Bloom filters, as used in BIP 37, //! The filter construction proposed is an alternative to Bloom filters, as used in BIP 37,
//! that minimizes filter size by using Golomb-Rice coding for compression. //! that minimizes filter size by using Golomb-Rice coding for compression.
//! //!
//! USE : //! ## Example
//! // create a block filter for a block (server side)
//! //!
//! fn get_script_for_coin (coin: &OutPoint) -> Result<Script, BlockFilterError> { //! ```ignore
//! // get utxo ... //! fn get_script_for_coin(coin: &OutPoint) -> Result<Script, BlockFilterError> {
//! } //! // get utxo ...
//! }
//! //!
//! let filter = BlockFilter::new_script_filter (&block, get_script_for_coin)?; //! // create a block filter for a block (server side)
//! let filter = BlockFilter::new_script_filter(&block, get_script_for_coin)?;
//! //!
//! // or create a filter from known raw data //! // or create a filter from known raw data
//! let filter = BlockFilter::new(content); //! let filter = BlockFilter::new(content);
//! //!
//! // read and evaluate a filter //! // read and evaluate a filter
//!
//! let query: Iterator<Item=Script> = // .. some scripts you care about
//! if filter.match_any (&block_hash, &mut query.map(|s| s.as_bytes())) {
//! // get this block
//! }
//! //!
//! let query: Iterator<Item=Script> = // .. some scripts you care about
//! if filter.match_any(&block_hash, &mut query.map(|s| s.as_bytes())) {
//! // get this block
//! }
//! ```
//! //!
use std::{cmp, fmt, io}; use std::{cmp, fmt, io};