diff --git a/CHANGELOG.md b/CHANGELOG.md index ee56c1b..ded5810 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Added ### Changed +- `base64` dependency was bumped to 0.21 ### Removed diff --git a/Cargo.lock b/Cargo.lock index 031fbb5..1e460cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9,14 +9,51 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "atty" -version = "0.2.14" +name = "anstream" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ - "hermit-abi", - "libc", - "winapi", + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", ] [[package]] @@ -33,21 +70,15 @@ checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" [[package]] name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bitflags" -version = "1.3.2" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cfg-if" @@ -57,27 +88,36 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.2.22" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ - "atty", - "bitflags", + "anstream", + "anstyle", "clap_lex", - "indexmap", "strsim", - "termcolor", - "textwrap", ] [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "crc32fast" @@ -90,9 +130,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.6" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if", "crossbeam-utils", @@ -100,19 +140,18 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.11" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", - "once_cell", ] [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -120,9 +159,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -131,20 +170,14 @@ dependencies = [ [[package]] name = "gmp-mpfr-sys" -version = "1.4.10" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea3f42dadb6c75f122e9aa87e757ef11d4282f664c9f2e6476a9c2c8970f9d19" +checksum = "19c5c67d8c29fe87e3266e691dd60948e6e4df4496c53355ef3551142945721b" dependencies = [ "libc", - "winapi", + "windows-sys 0.42.0", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hdrhistogram" version = "7.5.3" @@ -161,42 +194,23 @@ dependencies = [ "rug", ] -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "ieee754" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9007da9cacbd3e6343da136e98b0d2df013f553d35bdec8b518f07bea768e19c" -[[package]] -name = "indexmap" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" -dependencies = [ - "autocfg", - "hashbrown", -] - [[package]] name = "libc" -version = "0.2.132" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "minimal-lexical" @@ -206,18 +220,18 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -225,30 +239,18 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] -[[package]] -name = "once_cell" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" - -[[package]] -name = "os_str_bytes" -version = "6.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" - [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "rand" @@ -282,9 +284,9 @@ dependencies = [ [[package]] name = "rug" -version = "1.17.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "203180f444c95eac53586ed04793ecf6454c5d28f9eca8eead815fc19e136c47" +checksum = "5a118f8296241f6952511e8f9ab5b8a759c0d9ed902159b0aeed82d902e84ca6" dependencies = [ "az", "gmp-mpfr-sys", @@ -298,19 +300,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.15.1" +name = "utf8parse" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "wasi" @@ -319,32 +312,124 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "winapi" -version = "0.3.9" +name = "windows-sys" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" +name = "windows-sys" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] [[package]] -name = "winapi-util" -version = "0.1.5" +name = "windows-targets" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "winapi", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/Cargo.toml b/Cargo.toml index 552dacd..8002f1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,13 +31,13 @@ num-traits = "0.2" byteorder = "1.0.0" flate2 = { version = "1.0.3", optional = true } nom = { version = "7.0.0", optional = true } -base64 = { version = "0.13", optional = true } +base64 = { version = "0.21", optional = true } crossbeam-channel = { version = "0.5", optional = true } [dev-dependencies] rand = { version = "0.8", features = ["small_rng"] } ieee754 = "0.2.2" -clap = "3" +clap = { version = "4", features = ["string"] } [target.'cfg(unix)'.dev-dependencies] rug = "1.2" diff --git a/examples/cli.rs b/examples/cli.rs index 6b9a840..160de53 100644 --- a/examples/cli.rs +++ b/examples/cli.rs @@ -3,7 +3,7 @@ use std::fmt::Display; use std::io; use std::io::{BufRead, Write}; -use clap::{App, Arg}; +use clap::{Arg, Command}; use hdrhistogram::serialization::{ DeserializeError, Deserializer, Serializer, V2DeflateSerializeError, V2DeflateSerializer, @@ -13,9 +13,9 @@ use hdrhistogram::{Histogram, RecordError}; fn main() { let default_max = format!("{}", u64::max_value()); - let matches = App::new("hdrhistogram cli") + let matches = Command::new("hdrhistogram cli") .subcommand( - App::new("serialize") + Command::new("serialize") .about( "Transform number-per-line input from stdin \ into a serialized histogram on stdout", @@ -24,21 +24,21 @@ fn main() { Arg::new("min") .long("min") .help("Minimum discernible value") - .takes_value(true) + .value_parser(clap::value_parser!(u64)) .default_value("1"), ) .arg( Arg::new("max") .long("max") .help("Maximum trackable value") - .takes_value(true) - .default_value(default_max.as_str()), + .value_parser(clap::value_parser!(u64)) + .default_value(clap::builder::OsStr::from(default_max)), ) .arg( Arg::new("sigfig") .long("sigfig") .help("Number of significant digits") - .takes_value(true) + .value_parser(clap::value_parser!(u8)) .default_value("3"), ) .arg( @@ -55,20 +55,20 @@ fn main() { ), ) .subcommand( - App::new("iter-quantiles") + Command::new("iter-quantiles") .about("Display quantiles to stdout from serialized histogram stdin") .arg( Arg::new("ticks") .short('t') .long("ticks-per-half") - .takes_value(true) .required(true) + .value_parser(clap::value_parser!(u32)) .help("Ticks per half distance"), ) .arg( Arg::new("quantile-precision") .long("quantile-precision") - .takes_value(true) + .value_parser(clap::value_parser!(usize)) .default_value("20"), ), ) @@ -83,25 +83,24 @@ fn main() { match matches.subcommand_name() { Some("serialize") => { let sub_matches = matches.subcommand_matches("serialize").unwrap(); - let min = sub_matches.value_of("min").unwrap().parse().unwrap(); - let max = sub_matches.value_of("max").unwrap().parse().unwrap(); - let sigfig = sub_matches.value_of("sigfig").unwrap().parse().unwrap(); + let min = sub_matches.get_one::("min").cloned().unwrap(); + let max = sub_matches.get_one::("max").cloned().unwrap(); + let sigfig = sub_matches.get_one::("sigfig").cloned().unwrap(); let mut h: Histogram = Histogram::new_with_bounds(min, max, sigfig).unwrap(); - if sub_matches.is_present("resize") { + if sub_matches.contains_id("resize") { h.auto(true); } - serialize(stdin, stdout, h, sub_matches.is_present("compression")) + serialize(stdin, stdout, h, sub_matches.contains_id("compression")) } Some("iter-quantiles") => { let sub_matches = matches.subcommand_matches("iter-quantiles").unwrap(); - let ticks_per_half = sub_matches.value_of("ticks").unwrap().parse().unwrap(); + let ticks_per_half = sub_matches.get_one::("ticks").cloned().unwrap(); let quantile_precision = sub_matches - .value_of("quantile-precision") - .unwrap() - .parse() + .get_one::("quantile-precision") + .cloned() .unwrap(); quantiles(stdin, stdout, quantile_precision, ticks_per_half) } diff --git a/src/serialization/interval_log/mod.rs b/src/serialization/interval_log/mod.rs index 3f39e50..c4a4d02 100644 --- a/src/serialization/interval_log/mod.rs +++ b/src/serialization/interval_log/mod.rs @@ -217,6 +217,7 @@ use std::fmt::Write; use std::str::FromStr; use std::{fmt, io, ops, str, time}; +use base64::Engine as _; use nom::branch::alt; use nom::bytes::complete::{tag, take, take_until, take_while1}; use nom::character::complete::char; @@ -486,7 +487,7 @@ impl<'a, 'b, W: 'a + io::Write, S: 'b + Serializer> InternalLogWriter<'a, 'b, W, .serializer .serialize(h, &mut self.serialize_buf) .map_err(IntervalLogWriterError::SerializeError)?; - base64::encode_config_buf(&self.serialize_buf, base64::STANDARD, &mut self.text_buf); + base64::engine::general_purpose::STANDARD.encode_string(&self.serialize_buf, &mut self.text_buf); self.writer.write_all(self.text_buf.as_bytes())?; self.writer.write_all(b"\n")?; diff --git a/tests/interval_log.rs b/tests/interval_log.rs index 71abb1d..e1eabaf 100644 --- a/tests/interval_log.rs +++ b/tests/interval_log.rs @@ -1,5 +1,7 @@ #[cfg(all(feature = "serialization", test))] mod tests { + use base64::Engine as _; + use base64::engine::general_purpose::STANDARD as B64STANDARD; use hdrhistogram::serialization::interval_log::{ IntervalLogHistogram, IntervalLogIterator, IntervalLogWriterBuilder, LogEntry, LogIteratorError, Tag, @@ -118,7 +120,7 @@ mod tests { let mut deserializer = Deserializer::new(); for ilh in intervals { let serialized_histogram = - base64::decode_config(ilh.encoded_histogram(), base64::STANDARD).unwrap(); + B64STANDARD.decode(ilh.encoded_histogram()).unwrap(); let decoded_hist: Histogram = deserializer .deserialize(&mut io::Cursor::new(&serialized_histogram)) .unwrap(); @@ -150,7 +152,7 @@ mod tests { .for_each(|mut line| { let hist_index = line.rfind("HISTF").unwrap(); let serialized = - base64::decode_config(&line[hist_index..], base64::STANDARD).unwrap(); + B64STANDARD.decode(&line[hist_index..]).unwrap(); let decoded_hist: Histogram = deserializer .deserialize(&mut io::Cursor::new(serialized)) @@ -163,7 +165,7 @@ mod tests { // replace the deflate histogram with the predictable non-deflate one line.truncate(hist_index); - line.push_str(&base64::encode_config(&serialize_buf, base64::STANDARD)); + B64STANDARD.encode_string(&serialize_buf, &mut line); log_without_headers.extend_from_slice(line.as_bytes()); log_without_headers.extend_from_slice("\n".as_bytes()); @@ -185,7 +187,7 @@ mod tests { }) .for_each(|ilh| { let serialized_histogram = - base64::decode_config(ilh.encoded_histogram(), base64::STANDARD).unwrap(); + B64STANDARD.decode(ilh.encoded_histogram()).unwrap(); let decoded_hist: Histogram = deserializer .deserialize(&mut io::Cursor::new(&serialized_histogram)) .unwrap(); @@ -281,7 +283,7 @@ mod tests { let mut deserializer = Deserializer::new(); for (index, ilh) in parsed.iter().enumerate() { let serialized_histogram = - base64::decode_config(ilh.encoded_histogram(), base64::STANDARD).unwrap(); + B64STANDARD.decode(ilh.encoded_histogram()).unwrap(); let decoded_hist: Histogram = deserializer .deserialize(&mut io::Cursor::new(&serialized_histogram)) .unwrap();