mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: snapshot
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -3291,12 +3291,14 @@ checksum = "8f54a172d0620933a27a4360d3db3e2ae0dd6cceae9730751a036bbf182c4b23"
|
||||
name = "vecdb"
|
||||
version = "0.6.8"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"libc",
|
||||
"log",
|
||||
"lz4_flex 0.12.0",
|
||||
"parking_lot",
|
||||
"pco",
|
||||
"rawdb",
|
||||
"ryu",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
||||
@@ -62,8 +62,8 @@ impl fmt::Display for AnyAddressIndex {
|
||||
|
||||
impl Formattable for AnyAddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,9 +164,8 @@ impl std::fmt::Display for BasisPoints16 {
|
||||
|
||||
impl Formattable for BasisPoints16 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +137,8 @@ impl std::fmt::Display for BasisPoints32 {
|
||||
|
||||
impl Formattable for BasisPoints32 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,9 +160,8 @@ impl std::fmt::Display for BasisPointsSigned16 {
|
||||
|
||||
impl Formattable for BasisPointsSigned16 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,9 +166,8 @@ impl std::fmt::Display for BasisPointsSigned32 {
|
||||
|
||||
impl Formattable for BasisPointsSigned32 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,9 +143,8 @@ impl std::fmt::Display for Bitcoin {
|
||||
|
||||
impl Formattable for Bitcoin {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = ryu::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = ryu::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,8 @@ impl std::fmt::Display for BlkPosition {
|
||||
|
||||
impl Formattable for BlkPosition {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,9 +93,16 @@ impl<'de> Deserialize<'de> for BlockHash {
|
||||
}
|
||||
|
||||
impl Formattable for BlockHash {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,9 +282,8 @@ impl std::fmt::Display for Cents {
|
||||
|
||||
impl Formattable for Cents {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,10 +114,9 @@ impl Div<usize> for CentsSats {
|
||||
|
||||
impl Formattable for CentsSats {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -261,9 +261,8 @@ impl std::fmt::Display for CentsSigned {
|
||||
|
||||
impl Formattable for CentsSigned {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,10 +109,9 @@ impl Div<usize> for CentsSquaredSats {
|
||||
|
||||
impl Formattable for CentsSquaredSats {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -260,10 +260,17 @@ impl FromStr for Date {
|
||||
}
|
||||
|
||||
impl Formattable for Date {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -216,9 +216,8 @@ impl fmt::Display for Day1 {
|
||||
|
||||
impl Formattable for Day1 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,8 @@ impl std::fmt::Display for Day3 {
|
||||
|
||||
impl Formattable for Day3 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,10 +110,9 @@ impl std::fmt::Display for DifficultyEpoch {
|
||||
|
||||
impl Formattable for DifficultyEpoch {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -434,9 +434,8 @@ impl std::fmt::Display for Dollars {
|
||||
|
||||
impl Formattable for Dollars {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = ryu::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = ryu::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,16 +49,28 @@ impl std::fmt::Display for EmptyAddressData {
|
||||
}
|
||||
|
||||
impl Formattable for EmptyAddressData {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
impl Bytes for EmptyAddressData {
|
||||
|
||||
@@ -82,7 +82,7 @@ impl std::fmt::Display for EmptyAddressIndex {
|
||||
|
||||
impl Formattable for EmptyAddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ impl fmt::Display for EmptyOutputIndex {
|
||||
|
||||
impl Formattable for EmptyOutputIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,9 +122,8 @@ impl std::fmt::Display for FeeRate {
|
||||
|
||||
impl Formattable for FeeRate {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = ryu::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = ryu::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,16 +169,28 @@ impl std::fmt::Display for FundedAddressData {
|
||||
}
|
||||
|
||||
impl Formattable for FundedAddressData {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
impl Bytes for FundedAddressData {
|
||||
|
||||
@@ -78,7 +78,7 @@ impl std::fmt::Display for FundedAddressIndex {
|
||||
|
||||
impl Formattable for FundedAddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,10 +116,9 @@ impl std::fmt::Display for HalvingEpoch {
|
||||
|
||||
impl Formattable for HalvingEpoch {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -286,10 +286,9 @@ impl std::fmt::Display for Height {
|
||||
|
||||
impl Formattable for Height {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,9 +81,8 @@ impl std::fmt::Display for Hour1 {
|
||||
|
||||
impl Formattable for Hour1 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,8 @@ impl std::fmt::Display for Hour12 {
|
||||
|
||||
impl Formattable for Hour12 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,8 @@ impl std::fmt::Display for Hour4 {
|
||||
|
||||
impl Formattable for Hour4 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,8 @@ impl std::fmt::Display for Minute10 {
|
||||
|
||||
impl Formattable for Minute10 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,8 @@ impl std::fmt::Display for Minute30 {
|
||||
|
||||
impl Formattable for Minute30 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,9 +135,8 @@ impl std::fmt::Display for Month1 {
|
||||
|
||||
impl Formattable for Month1 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,9 +129,8 @@ impl std::fmt::Display for Month3 {
|
||||
|
||||
impl Formattable for Month3 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,9 +121,8 @@ impl std::fmt::Display for Month6 {
|
||||
|
||||
impl Formattable for Month6 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,16 +128,28 @@ impl Display for OHLCCents {
|
||||
}
|
||||
|
||||
impl Formattable for OHLCCents {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
impl Bytes for OHLCCents {
|
||||
@@ -259,16 +271,28 @@ impl Display for OHLCDollars {
|
||||
}
|
||||
|
||||
impl Formattable for OHLCDollars {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
impl Bytes for OHLCDollars {
|
||||
@@ -359,16 +383,28 @@ impl Display for OHLCSats {
|
||||
}
|
||||
|
||||
impl Formattable for OHLCSats {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
impl Bytes for OHLCSats {
|
||||
@@ -518,10 +554,17 @@ impl<T> Formattable for Open<T>
|
||||
where
|
||||
T: Display,
|
||||
{
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,10 +693,17 @@ impl<T> Formattable for High<T>
|
||||
where
|
||||
T: Display,
|
||||
{
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -782,10 +832,17 @@ impl<T> Formattable for Low<T>
|
||||
where
|
||||
T: Display,
|
||||
{
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -937,9 +994,16 @@ impl<T> Formattable for Close<T>
|
||||
where
|
||||
T: Display,
|
||||
{
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ impl std::fmt::Display for OpReturnIndex {
|
||||
|
||||
impl Formattable for OpReturnIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,10 +144,17 @@ impl Bytes for OracleBins {
|
||||
}
|
||||
|
||||
impl Formattable for OracleBins {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,9 +307,16 @@ impl Bytes for OracleBinsV2 {
|
||||
}
|
||||
|
||||
impl Formattable for OracleBinsV2 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,16 +47,28 @@ impl std::fmt::Display for OutPoint {
|
||||
}
|
||||
|
||||
impl Formattable for OutPoint {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for OutPoint {
|
||||
|
||||
@@ -205,10 +205,17 @@ impl TryFrom<OutputType> for AddressType {
|
||||
}
|
||||
|
||||
impl Formattable for OutputType {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ impl std::fmt::Display for P2AAddressIndex {
|
||||
|
||||
impl Formattable for P2AAddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,26 @@ impl fmt::Display for P2ABytes {
|
||||
}
|
||||
|
||||
impl Formattable for P2ABytes {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ impl std::fmt::Display for P2MSOutputIndex {
|
||||
|
||||
impl Formattable for P2MSOutputIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ impl std::fmt::Display for P2PK33AddressIndex {
|
||||
|
||||
impl Formattable for P2PK33AddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,26 @@ impl fmt::Display for P2PK33Bytes {
|
||||
}
|
||||
|
||||
impl Formattable for P2PK33Bytes {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ impl std::fmt::Display for P2PK65AddressIndex {
|
||||
|
||||
impl Formattable for P2PK65AddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,26 @@ impl fmt::Display for P2PK65Bytes {
|
||||
}
|
||||
|
||||
impl Formattable for P2PK65Bytes {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ impl std::fmt::Display for P2PKHAddressIndex {
|
||||
|
||||
impl Formattable for P2PKHAddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,26 @@ impl fmt::Display for P2PKHBytes {
|
||||
}
|
||||
|
||||
impl Formattable for P2PKHBytes {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ impl std::fmt::Display for P2SHAddressIndex {
|
||||
|
||||
impl Formattable for P2SHAddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,26 @@ impl fmt::Display for P2SHBytes {
|
||||
}
|
||||
|
||||
impl Formattable for P2SHBytes {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ impl std::fmt::Display for P2TRAddressIndex {
|
||||
|
||||
impl Formattable for P2TRAddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,26 @@ impl fmt::Display for P2TRBytes {
|
||||
}
|
||||
|
||||
impl Formattable for P2TRBytes {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ impl std::fmt::Display for P2WPKHAddressIndex {
|
||||
|
||||
impl Formattable for P2WPKHAddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,26 @@ impl fmt::Display for P2WPKHBytes {
|
||||
}
|
||||
|
||||
impl Formattable for P2WPKHBytes {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ impl std::fmt::Display for P2WSHAddressIndex {
|
||||
|
||||
impl Formattable for P2WSHAddressIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,26 @@ impl fmt::Display for P2WSHBytes {
|
||||
}
|
||||
|
||||
impl Formattable for P2WSHBytes {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +115,8 @@ impl std::fmt::Display for PairOutputIndex {
|
||||
|
||||
impl Formattable for PairOutputIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,10 +410,17 @@ impl PoolSlug {
|
||||
}
|
||||
|
||||
impl Formattable for PoolSlug {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,14 +38,26 @@ impl std::fmt::Display for RawLockTime {
|
||||
}
|
||||
|
||||
impl Formattable for RawLockTime {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,9 +346,8 @@ impl std::fmt::Display for Sats {
|
||||
|
||||
impl Formattable for Sats {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,9 +214,8 @@ impl std::fmt::Display for SatsSigned {
|
||||
|
||||
impl Formattable for SatsSigned {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,10 +188,9 @@ impl std::fmt::Display for SatsFract {
|
||||
|
||||
impl Formattable for SatsFract {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = ryu::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = ryu::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,7 @@ impl std::fmt::Display for StoredBool {
|
||||
|
||||
impl Formattable for StoredBool {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
f.push_str(if self.is_true() { "true" } else { "false" });
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
buf.extend_from_slice(if self.is_true() { b"true" } else { b"false" });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,9 +273,8 @@ impl std::fmt::Display for StoredF32 {
|
||||
|
||||
impl Formattable for StoredF32 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = ryu::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = ryu::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,9 +246,8 @@ impl std::fmt::Display for StoredF64 {
|
||||
|
||||
impl Formattable for StoredF64 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = ryu::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = ryu::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,9 +117,8 @@ impl std::fmt::Display for StoredI16 {
|
||||
|
||||
impl Formattable for StoredI16 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,9 +132,8 @@ impl std::fmt::Display for StoredI64 {
|
||||
|
||||
impl Formattable for StoredI64 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,9 +117,8 @@ impl std::fmt::Display for StoredI8 {
|
||||
|
||||
impl Formattable for StoredI8 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,9 +208,8 @@ impl std::fmt::Display for StoredU16 {
|
||||
|
||||
impl Formattable for StoredU16 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,9 +260,8 @@ impl std::fmt::Display for StoredU32 {
|
||||
|
||||
impl Formattable for StoredU32 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,9 +275,8 @@ impl std::fmt::Display for StoredU64 {
|
||||
|
||||
impl Formattable for StoredU64 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,9 +108,8 @@ impl std::fmt::Display for StoredU8 {
|
||||
|
||||
impl Formattable for StoredU8 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,16 +82,28 @@ impl fmt::Display for SupplyState {
|
||||
}
|
||||
|
||||
impl Formattable for SupplyState {
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let start = f.len();
|
||||
write!(f, "{}", self)?;
|
||||
self.fmt_into(f);
|
||||
if f.as_bytes()[start..].contains(&b',') {
|
||||
f.insert(start, '"');
|
||||
f.push('"');
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
impl Bytes for SupplyState {
|
||||
|
||||
@@ -189,9 +189,8 @@ impl std::fmt::Display for Timestamp {
|
||||
|
||||
impl Formattable for Timestamp {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,9 +84,16 @@ impl<'de> Deserialize<'de> for Txid {
|
||||
}
|
||||
|
||||
impl Formattable for Txid {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
use std::fmt::Write;
|
||||
write!(f, "{}", self)
|
||||
let mut s = String::new();
|
||||
write!(s, "{}", self).unwrap();
|
||||
buf.extend_from_slice(s.as_bytes());
|
||||
}
|
||||
|
||||
fn fmt_json(&self, buf: &mut Vec<u8>) {
|
||||
buf.push(b'"');
|
||||
self.write_to(buf);
|
||||
buf.push(b'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,9 +170,8 @@ impl std::fmt::Display for TxIndex {
|
||||
|
||||
impl Formattable for TxIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,9 +131,8 @@ impl std::fmt::Display for TxInIndex {
|
||||
|
||||
impl Formattable for TxInIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,9 +132,8 @@ impl std::fmt::Display for TxOutIndex {
|
||||
|
||||
impl Formattable for TxOutIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,8 @@ impl std::fmt::Display for TxVersion {
|
||||
|
||||
impl Formattable for TxVersion {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,9 +147,8 @@ impl std::fmt::Display for TypeIndex {
|
||||
|
||||
impl Formattable for TypeIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ impl std::fmt::Display for UnknownOutputIndex {
|
||||
|
||||
impl Formattable for UnknownOutputIndex {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
self.0.fmt_csv(f)
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
self.0.write_to(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,9 +98,8 @@ impl std::fmt::Display for Vout {
|
||||
|
||||
impl Formattable for Vout {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,9 +121,8 @@ impl std::fmt::Display for VSize {
|
||||
|
||||
impl Formattable for VSize {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,9 +145,8 @@ impl std::fmt::Display for Week1 {
|
||||
|
||||
impl Formattable for Week1 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +137,8 @@ impl std::fmt::Display for Weight {
|
||||
|
||||
impl Formattable for Weight {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,9 +124,8 @@ impl std::fmt::Display for Year {
|
||||
|
||||
impl Formattable for Year {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,9 +142,8 @@ impl std::fmt::Display for Year1 {
|
||||
|
||||
impl Formattable for Year1 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,9 +144,8 @@ impl std::fmt::Display for Year10 {
|
||||
|
||||
impl Formattable for Year10 {
|
||||
#[inline(always)]
|
||||
fn fmt_csv(&self, f: &mut String) -> std::fmt::Result {
|
||||
let mut buf = itoa::Buffer::new();
|
||||
f.push_str(buf.format(self.0));
|
||||
Ok(())
|
||||
fn write_to(&self, buf: &mut Vec<u8>) {
|
||||
let mut b = itoa::Buffer::new();
|
||||
buf.extend_from_slice(b.format(self.0).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user