pub struct Interface<'a> { /* private fields */ }Implementations§
Source§impl<'a> Interface<'a>
impl<'a> Interface<'a>
Sourcepub fn build(parser: &Parser, indexer: &Indexer, computer: &Computer) -> Self
pub fn build(parser: &Parser, indexer: &Indexer, computer: &Computer) -> Self
Examples found in repository?
examples/main.rs (line 37)
10pub fn main() -> Result<()> {
11 let bitcoin_dir = Path::new(&std::env::var("HOME").unwrap())
12 .join("Library")
13 .join("Application Support")
14 .join("Bitcoin");
15 // let bitcoin_dir = Path::new("/Volumes/WD_BLACK1/bitcoin");
16
17 let blocks_dir = bitcoin_dir.join("blocks");
18
19 let outputs_dir = Path::new(&std::env::var("HOME").unwrap()).join(".brk");
20 fs::create_dir_all(&outputs_dir)?;
21 // let outputs_dir = Path::new("/Volumes/WD_BLACK1/brk");
22
23 let rpc = Box::leak(Box::new(bitcoincore_rpc::Client::new(
24 "http://localhost:8332",
25 bitcoincore_rpc::Auth::CookieFile(bitcoin_dir.join(".cookie")),
26 )?));
27
28 let exit = Exit::new();
29 exit.set_ctrlc_handler();
30
31 let parser = Parser::new(blocks_dir, rpc);
32
33 let indexer = Indexer::forced_import(&outputs_dir)?;
34
35 let computer = Computer::forced_import(&outputs_dir, &indexer, None)?;
36
37 let interface = Interface::build(&parser, &indexer, &computer);
38
39 dbg!(interface.search_and_format(Params {
40 index: Index::Height,
41 metrics: vec!["date"].into(),
42 rest: ParamsOpt::default().set_from(-1),
43 })?);
44 dbg!(interface.search_and_format(Params {
45 index: Index::Height,
46 metrics: vec!["date", "timestamp"].into(),
47 rest: ParamsOpt::default().set_from(-10).set_count(5),
48 })?);
49
50 Ok(())
51}pub fn get_height(&self) -> Height
pub fn search( &self, params: &Params, ) -> Result<Vec<(String, &&dyn AnyCollectableVec)>>
pub fn format( &self, metrics: Vec<(String, &&dyn AnyCollectableVec)>, params: &ParamsOpt, ) -> Result<Output>
Sourcepub fn search_and_format(&self, params: Params) -> Result<Output>
pub fn search_and_format(&self, params: Params) -> Result<Output>
Examples found in repository?
examples/main.rs (lines 39-43)
10pub fn main() -> Result<()> {
11 let bitcoin_dir = Path::new(&std::env::var("HOME").unwrap())
12 .join("Library")
13 .join("Application Support")
14 .join("Bitcoin");
15 // let bitcoin_dir = Path::new("/Volumes/WD_BLACK1/bitcoin");
16
17 let blocks_dir = bitcoin_dir.join("blocks");
18
19 let outputs_dir = Path::new(&std::env::var("HOME").unwrap()).join(".brk");
20 fs::create_dir_all(&outputs_dir)?;
21 // let outputs_dir = Path::new("/Volumes/WD_BLACK1/brk");
22
23 let rpc = Box::leak(Box::new(bitcoincore_rpc::Client::new(
24 "http://localhost:8332",
25 bitcoincore_rpc::Auth::CookieFile(bitcoin_dir.join(".cookie")),
26 )?));
27
28 let exit = Exit::new();
29 exit.set_ctrlc_handler();
30
31 let parser = Parser::new(blocks_dir, rpc);
32
33 let indexer = Indexer::forced_import(&outputs_dir)?;
34
35 let computer = Computer::forced_import(&outputs_dir, &indexer, None)?;
36
37 let interface = Interface::build(&parser, &indexer, &computer);
38
39 dbg!(interface.search_and_format(Params {
40 index: Index::Height,
41 metrics: vec!["date"].into(),
42 rest: ParamsOpt::default().set_from(-1),
43 })?);
44 dbg!(interface.search_and_format(Params {
45 index: Index::Height,
46 metrics: vec!["date", "timestamp"].into(),
47 rest: ParamsOpt::default().set_from(-10).set_count(5),
48 })?);
49
50 Ok(())
51}pub fn metric_to_index_to_vec(&self) -> &BTreeMap<&str, IndexToVec<'_>>
pub fn index_to_metric_to_vec(&self) -> &BTreeMap<Index, MetricToVec<'_>>
pub fn distinct_metric_count(&self) -> usize
pub fn total_metric_count(&self) -> usize
pub fn get_indexes(&self) -> &BTreeMap<&'static str, &'static [&'static str]>
pub fn get_metrics(&self, pagination: PaginationParam) -> &[&str]
pub fn get_index_to_vecids( &self, paginated_index: PaginatedIndexParam, ) -> Vec<&str>
pub fn metric_to_indexes(&self, metric: String) -> Option<&Vec<&'static str>>
pub fn parser(&self) -> &Parser
pub fn indexer(&self) -> &Indexer
pub fn computer(&self) -> &Computer
Auto Trait Implementations§
impl<'a> Freeze for Interface<'a>
impl<'a> !RefUnwindSafe for Interface<'a>
impl<'a> Send for Interface<'a>
impl<'a> Sync for Interface<'a>
impl<'a> Unpin for Interface<'a>
impl<'a> !UnwindSafe for Interface<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more