mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-02 18:40:00 -07:00
bindex: snapshot
This commit is contained in:
18
bomputer/src/lib.rs
Normal file
18
bomputer/src/lib.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
mod structs;
|
||||
|
||||
use structs::*;
|
||||
|
||||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
19
bomputer/src/structs/date.rs
Normal file
19
bomputer/src/structs/date.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use jiff::tz::TimeZone;
|
||||
|
||||
use super::Timestamp;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Date(jiff::civil::Date);
|
||||
|
||||
impl From<&Timestamp> for Date {
|
||||
fn from(value: &Timestamp) -> Self {
|
||||
Self(jiff::civil::Date::from(value.to_zoned(TimeZone::UTC)))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Date> for usize {
|
||||
// 2009-01-03 => 0
|
||||
// 2009-01-09 => 1
|
||||
// 2009-01-10 => 2
|
||||
// ...
|
||||
}
|
||||
4
bomputer/src/structs/feerate.rs
Normal file
4
bomputer/src/structs/feerate.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
use derive_deref::Deref;
|
||||
|
||||
#[derive(Debug, Deref, Clone, Copy)]
|
||||
pub struct Feerate(f32);
|
||||
5
bomputer/src/structs/mod.rs
Normal file
5
bomputer/src/structs/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
mod date;
|
||||
mod feerate;
|
||||
|
||||
pub use date::*;
|
||||
pub use feerate::*;
|
||||
Reference in New Issue
Block a user