commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
1f23c0b323db08a455a32f761af305162f3aa869 | Brian Anderson | 2017-03-04T04:52:45 | Add html_root_url to lib.rs. Fixes #77 | diff --git a/Cargo.toml b/Cargo.toml
index 887c561..f8139ba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,6 @@
[package]
name = "byteorder"
+# NB: When modifying, also modify html_root_url in lib.rs
version = "1.0.0" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Library for readi... | 2 | 2 | 0 |
08561130c567b442ecbc7d1e6a744df723f2c708 | Brian Anderson | 2017-03-04T04:46:35 | Add 'Panics' headers. Fixes #72 | diff --git a/src/lib.rs b/src/lib.rs
index ae60563..a92d4cd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -120,48 +120,66 @@ pub trait ByteOrder
: Clone + Copy + Debug + Default + Eq + Hash + Ord + PartialEq + PartialOrd {
/// Reads an unsigned 16 bit integer from `buf`.
///
+ /// # Panics
+ ///
... | 2 | 44 | 0 |
6eb15de77602d7700a07444d5a732bec6c7241b9 | Brian Anderson | 2017-03-04T04:41:16 | Panic in default methods. Fixes #68 | diff --git a/src/lib.rs b/src/lib.rs
index e524560..ae60563 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -268,7 +268,7 @@ pub enum BigEndian {}
impl Default for BigEndian {
fn default() -> BigEndian {
- unreachable!()
+ panic!("BigEndian default")
}
}
@@ -281,7 +281,7 @@ pub enum LittleEndi... | 1 | 2 | 2 |
b9bffe74aeaf56da9edfa0325eec2252a3c4f494 | Sam Whited | 2017-03-23T02:45:56 | Add categories.
Fixes #73
See #76 | diff --git a/Cargo.toml b/Cargo.toml
index d207d47..887c561 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,6 +7,7 @@ documentation = "https://docs.rs/byteorder"
homepage = "https://github.com/BurntSushi/byteorder"
repository = "https://github.com/BurntSushi/byteorder"
readme = "README.md"
+categories = ["encoding", ... | 1 | 1 | 0 |
d9426890c8c6a6631c2716c6bc720602bec4e606 | Andrew Gallant | 2016-12-30T18:08:55 | fix tests again | diff --git a/src/lib.rs b/src/lib.rs
index f27dcc7..e524560 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -695,8 +695,6 @@ mod test {
#[cfg(test)]
#[cfg(feature = "std")]
mod stdtests {
- use test::{U64_MAX, I64_MAX, qc_sized};
-
macro_rules! qc_bytes_ext {
($name:ident, $ty_int:ident, $max:expr,
... | 1 | 17 | 19 |
d9b95376d7ce79c9c763f14109612a3b070bf924 | Nick Fitzgerald | 2016-11-05T23:57:31 | Require impls for all derive-able traits for ByteOrder
This adds trait bounds to ByteOrder for all the traits that can
automatically be derived. Next, it derives them all for BigEndian and
LittleEndian. The exception is Default, which cannot be derived for
enums, and it is explicitly implemented as unreachable.
Fixes... | diff --git a/src/lib.rs b/src/lib.rs
index 8038f75..f27dcc7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -42,6 +42,8 @@ assert_eq!(wtr, vec![5, 2, 0, 3]);
#[cfg(feature = "std")]
extern crate core;
+use core::fmt::Debug;
+use core::hash::Hash;
use core::mem::transmute;
use core::ptr::copy_nonoverlapping;
@@ -114... | 1 | 20 | 3 |
a2efdd939f1d05379cb412e0b8670abcf5d6b9c6 | Andrew Gallant | 2016-12-30T18:02:49 | fix tests | diff --git a/src/lib.rs b/src/lib.rs
index eaaa274..8038f75 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -689,7 +689,7 @@ mod stdtests {
ReadBytesExt, WriteBytesExt,
BigEndian, NativeEndian, LittleEndian,
};
- use super::qc_sized;
+ ... | 1 | 2 | 2 |
cfdedf1881fcdcd1026569c702c37c37c444b213 | David Tulig | 2016-05-30T21:04:03 | Replacing std size_of with core size_of.
This allows byteorder to be used in a no_std context. | diff --git a/src/lib.rs b/src/lib.rs
index 5921bcb..a25bab6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -300,7 +300,7 @@ pub type NativeEndian = BigEndian;
macro_rules! read_num_bytes {
($ty:ty, $size:expr, $src:expr, $which:ident) => ({
- assert!($size == ::std::mem::size_of::<$ty>());
+ assert!(... | 1 | 1 | 1 |
f863c9eda89b5e2aa72d650991b815f9c960ed52 | Andrew Gallant | 2016-05-21T13:53:57 | Fixes undefined behavior reported in #47.
Instead of casting pointers, we do a proper unaligned load using
copy_nonoverlapping.
Benchmarks appear unaffected on Linux x64. | diff --git a/src/lib.rs b/src/lib.rs
index e4fddfe..5921bcb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -300,10 +300,16 @@ pub type NativeEndian = BigEndian;
macro_rules! read_num_bytes {
($ty:ty, $size:expr, $src:expr, $which:ident) => ({
+ assert!($size == ::std::mem::size_of::<$ty>());
assert... | 1 | 7 | 1 |
49f5882a72fd57c50ad41cf1ea2f847b2e76d288 | Brian Campbell | 2016-03-24T20:43:53 | Add NetworkEndian alias
Network byte order is defined by [RFC 1700][1] to be big-endian, and is
referred to in several protocol specifications. This type is an alias
of BigEndian. This alias can be used to make it more clear why you're
using a particular byte order in code, if you are implementing a
specification th... | diff --git a/src/lib.rs b/src/lib.rs
index aba9113..a57ebfd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -267,6 +267,18 @@ pub trait ByteOrder {
/// type level.
#[allow(missing_copy_implementations)] pub enum LittleEndian {}
+/// Defines network byte order serialization.
+///
+/// Network byte order is defined by [R... | 1 | 12 | 0 |
e8e4c878e065034d0cd2de3552fccaed3c445de2 | Luke Steensen | 2016-01-22T03:08:14 | remove unnecessary write_all implementation | diff --git a/src/new.rs b/src/new.rs
index eb4bdf2..b5f3770 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -130,10 +130,6 @@ pub trait ReadBytesExt: io::Read {
/// for free.
impl<R: io::Read + ?Sized> ReadBytesExt for R {}
-fn write_all<W: io::Write + ?Sized>(wtr: &mut W, buf: &[u8]) -> Result<()> {
- wtr.write_all... | 1 | 12 | 16 |
e429dfb9ccb74e32c5f1800a20318ea2162ef262 | Luke Steensen | 2016-01-22T02:55:43 | remove custom error type and read_full
Rust 1.6 stabilized `read_exact`, which gives us the same functionality without
having to wrap `std::io::Error`. Removing the custom error type makes this
a breaking change, and users will have to replace uses of `byteorder::Error`
with `std::io::Error`.
[breaking-change] | diff --git a/src/lib.rs b/src/lib.rs
index 7eea1e3..aba9113 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -45,7 +45,7 @@ use std::mem::transmute;
use std::ptr::copy_nonoverlapping;
#[cfg(not(feature = "no-std"))]
-pub use new::{ReadBytesExt, WriteBytesExt, Error, Result};
+pub use new::{ReadBytesExt, WriteBytesExt};
... | 2 | 14 | 90 |
4eccab0abbb865dae7f0a7c0159e21f3b3f8e4c7 | Andrew Gallant | 2015-11-07T23:31:43 | Fix bug. | diff --git a/src/new.rs b/src/new.rs
index fae3513..54ee6a7 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -307,7 +307,7 @@ pub trait WriteBytesExt: io::Write {
) -> Result<()> {
let mut buf = [0; 8];
T::write_uint(&mut buf, n, nbytes);
- write_all(self, &buf)
+ write_all(self, &buf[0.... | 1 | 2 | 2 |
7f30baf9714294f0bf1dd8c5488664f878159a44 | Andrew Gallant | 2015-11-07T23:27:00 | Add write_{int,uint} to WriteBytesExt trait. | diff --git a/src/new.rs b/src/new.rs
index bbef0cd..fae3513 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -295,6 +295,36 @@ pub trait WriteBytesExt: io::Write {
write_all(self, &buf)
}
+ /// Writes an unsigned n-bytes integer to the underlying writer.
+ ///
+ /// If the given integer is not repre... | 1 | 30 | 0 |
75d33fe4a804aca21d52ea6fa93374eaf0a67be3 | Andrew Gallant | 2015-11-07T23:22:53 | Add write_{int,uint}.
Since this adds a new required method on the `ByteOrder` trait, this is
a breaking change.
This should only break crates that have custom implementations of the
`ByteOrder` trait. To fix it, add an implementation for `write_uint`.
[breaking-change] | diff --git a/src/lib.rs b/src/lib.rs
index b08012c..7eea1e3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -42,6 +42,7 @@ assert_eq!(wtr, vec![5, 2, 0, 3]);
#![deny(missing_docs)]
use std::mem::transmute;
+use std::ptr::copy_nonoverlapping;
#[cfg(not(feature = "no-std"))]
pub use new::{ReadBytesExt, WriteBytesExt,... | 1 | 105 | 51 |
52520a22d1090887951b42b6cc796de8d8a0c432 | Łukasz Jan Niemier | 2015-11-06T10:36:03 | Allow builds without std dependency | diff --git a/Cargo.toml b/Cargo.toml
index 823b2ec..bd0bf21 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,5 +17,8 @@ name = "byteorder"
quickcheck = "0.2"
rand = "0.3"
+[features]
+no-std = []
+
[profile.bench]
opt-level = 3
diff --git a/src/lib.rs b/src/lib.rs
index 59ba692..b08012c 100644
--- a/src/lib.rs
+++... | 2 | 5 | 0 |
1cbf90d8d7b76975a9d6ae051a0e731f2bf64fcb | Cesar Eduardo Barros | 2015-07-05T23:18:23 | Add #[inline] to allow for cross-crate inlining | diff --git a/src/lib.rs b/src/lib.rs
index 174a22b..59ba692 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -47,6 +47,7 @@ pub use new::{ReadBytesExt, WriteBytesExt, Error, Result};
mod new;
+#[inline]
fn extend_sign(val: u64, nbytes: usize) -> i64 {
let shift = (8 - nbytes) * 8;
(val << shift) as i64 >> s... | 2 | 48 | 0 |
f1f61892ca5eeca63cc7fd5853682c6d9f061752 | Andrew Gallant | 2015-05-20T21:26:44 | Add 'binary' keyword. | diff --git a/Cargo.toml b/Cargo.toml
index be5695f..da13f61 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,7 +7,7 @@ documentation = "http://burntsushi.net/rustdoc/byteorder/"
homepage = "https://github.com/BurntSushi/byteorder"
repository = "https://github.com/BurntSushi/byteorder"
readme = "README.md"
-keywords = ... | 1 | 1 | 1 |
49c107d9aa4e5154cced520f15e9d6987a714990 | Andrew Gallant | 2015-05-20T21:26:37 | Move benchmarks to separate directory.
So we can run tests on stable/beta. | diff --git a/Cargo.toml b/Cargo.toml
index 37ac2cc..be5695f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,3 +16,6 @@ name = "byteorder"
[dev-dependencies]
quickcheck = "*"
rand = "*"
+
+[profile.bench]
+opt-level = 3
diff --git a/benches/bench.rs b/benches/bench.rs
new file mode 100644
index 0000000..51d57b3
--- /... | 3 | 151 | 151 |
303c86dc6bd355c4776b04cf75ce950c0d3b532d | Geoffrey Thomas | 2015-05-20T06:14:33 | Change "Task failure occurs when" to "Panics when"
The term "task failure" is obsolete (see RFC 221). | diff --git a/src/lib.rs b/src/lib.rs
index 52cab1b..7b269cc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -87,64 +87,64 @@ fn extend_sign(val: u64, nbytes: usize) -> i64 {
pub trait ByteOrder {
/// Reads an unsigned 16 bit integer from `buf`.
///
- /// Task failure occurs when `buf.len() < 2`.
+ /// Pani... | 1 | 18 | 18 |
d9c9ee3bed2e4839a345a03b429074330902d800 | Andrew Gallant | 2015-04-25T03:20:18 | Improvements after being poked by @joshtriplett. Thanks!
1. The syntax <T as ByteOrder>::foo() is no longer needed.
The docs/code has been updated to just use T::foo().
2. An extraneous `copy_nonoverlapping` was removed in some
cases. Benchmarks show no difference (probably due to
llvm being smart to elide it... | diff --git a/src/lib.rs b/src/lib.rs
index 0cdfc02..52cab1b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -58,7 +58,7 @@ fn extend_sign(val: u64, nbytes: usize) -> i64 {
///
/// Note that `Self` does not appear anywhere in this trait's definition!
/// Therefore, in order to use it, you'll need to use syntax like
-/// ... | 2 | 72 | 87 |
b8d12248946fcac08239373551fc48abe72b9ace | Andrew Gallant | 2015-04-22T11:01:02 | Fix weird ARM bug for @romanb. | diff --git a/src/lib.rs b/src/lib.rs
index 1b1cac9..0cdfc02 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -84,7 +84,7 @@ fn extend_sign(val: u64, nbytes: usize) -> i64 {
/// <BigEndian as ByteOrder>::write_i16(&mut buf, -50_000);
/// assert_eq!(-50_000, <BigEndian as ByteOrder>::read_i16(&buf));
/// ```
-pub trait Byt... | 1 | 4 | 3 |
a9328f33ec9367fdff4c72e627bfa7c206a09cbe | Anders Kaseorg | 2015-04-02T09:47:13 | Update for stabilized io::Error
As per https://github.com/rust-lang/rust/pull/23919, the last argument
was removed from Error::new, and the Clone, Eq, and PartialEq traits
were removed from Error.
Signed-off-by: Anders Kaseorg <andersk@mit.edu> | diff --git a/src/lib.rs b/src/lib.rs
index eb2df76..1b1cac9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -41,7 +41,6 @@ assert_eq!(wtr, vec![5, 2, 0, 3]);
#![deny(missing_docs)]
-#![feature(io)]
#![cfg_attr(test, feature(test))]
use std::mem::transmute;
diff --git a/src/new.rs b/src/new.rs
index f639ea2..5a2fcb... | 2 | 2 | 3 |
331cfa6d765dcc58789618732ec27858cf60c1a4 | Anders Kaseorg | 2015-04-02T09:45:01 | Replace FromError with From
As per https://github.com/rust-lang/rust/pull/23879.
Signed-off-by: Anders Kaseorg <andersk@mit.edu> | diff --git a/src/new.rs b/src/new.rs
index 1eac46a..f639ea2 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -26,12 +26,12 @@ pub enum Error {
Io(io::Error),
}
-impl error::FromError<io::Error> for Error {
- fn from_error(err: io::Error) -> Error { Error::Io(err) }
+impl From<io::Error> for Error {
+ fn from(e... | 1 | 6 | 6 |
95a217b8f441469f40ad62af43df388d97b5f72a | Andrew Gallant | 2015-04-01T13:46:11 | rustup
fixes #22 | diff --git a/src/lib.rs b/src/lib.rs
index 5ec649b..eb2df76 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -229,39 +229,36 @@ pub type NativeEndian = BigEndian;
macro_rules! read_num_bytes {
($ty:ty, $size:expr, $src:expr, $which:ident) => ({
- use std::num::Int;
use std::ptr::copy_nonoverlapping;
... | 1 | 5 | 9 |
14b1b0892e0ee72f658c28cfa926ff7a94e55439 | Andrew Gallant | 2015-03-25T23:33:38 | rustup. Unfortunately, revert the dependency on bswap because
I need a working crate.
Revert "Replaced read_num_bytes!/write_num_bytes! with rust-bswap decode/encode functions."
This reverts commit 718f3a8e0981e88189fbd7c35f3ed92104c32bae.
# Conflicts:
# Cargo.toml
# src/lib.rs | diff --git a/Cargo.toml b/Cargo.toml
index 7e3517b..3db4b0f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,9 +13,6 @@ license = "Unlicense"
[lib]
name = "byteorder"
-[dependencies]
-bswap = "*"
-
[dev-dependencies]
quickcheck = "*"
rand = "*"
diff --git a/src/lib.rs b/src/lib.rs
index d886d0d..5ec649b 100644
--... | 2 | 68 | 19 |
6807c32a4549ac2b2f98c7e60562d16b9f2bbd50 | Andrew Gallant | 2015-03-25T00:17:19 | Fix quickcheck ranges. | diff --git a/src/lib.rs b/src/lib.rs
index 39b5b13..d886d0d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -296,6 +296,9 @@ mod test {
use test::rand::thread_rng;
use test::quickcheck::{QuickCheck, StdGen, Testable};
+ const U64_MAX: u64 = ::std::u64::MAX;
+ const I64_MAX: u64 = ::std::i64::MAX as u64;
+... | 1 | 82 | 84 |
0aa9ca464e3ac842f47ee765901cf72c31416d4b | Zachary Dremann | 2015-03-19T20:38:56 | Add NativeEndian type
NativeEndian is simply a type alias to LittleEndian/BigEndian. | diff --git a/src/lib.rs b/src/lib.rs
index 73fc684..39b5b13 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -214,6 +214,20 @@ pub trait ByteOrder : std::marker::MarkerTrait {
/// type level.
#[allow(missing_copy_implementations)] pub enum LittleEndian {}
+/// Defines system native-endian serialization.
+///
+/// Note t... | 1 | 127 | 8 |
c94cdb1269207db0afae35e8d91b866eef454f57 | Andrew Gallant | 2015-03-15T14:31:21 | rustup
This removes support for `std::old_io` since it has been deprecated. | diff --git a/src/lib.rs b/src/lib.rs
index fa0e2b8..73fc684 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,11 +9,6 @@ and `LittleEndian` implement these methods. Finally, `ReadBytesExt` and
`WriteBytesExt` provide convenience methods available to all types that
implement `Read` and `Write`.
-**Future plans:** Curre... | 3 | 3 | 235 |
f22289d4003876fa179a64d13d074bc62bae6191 | rkjnsn | 2015-03-14T19:27:57 | Expand impl for unsized readers and writers | diff --git a/src/new.rs b/src/new.rs
index 65b5075..18a1188 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -179,7 +179,7 @@ pub trait ReadBytesExt: io::Read {
/// All types that implement `Read` get methods defined in `ReadBytesExt`
/// for free.
-impl<R: io::Read> ReadBytesExt for R {}
+impl<R: io::Read + ?Sized> Rea... | 1 | 2 | 2 |
0f6d142eb5be4a1447f29c903161236bc13e96e8 | Andrew Gallant | 2015-03-10T21:28:57 | rustup and 80 cols | diff --git a/src/lib.rs b/src/lib.rs
index eced60b..fa0e2b8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -111,7 +111,8 @@ pub trait ByteOrder : std::marker::MarkerTrait {
/// Reads an unsigned n-bytes integer from `buf`.
///
- /// Task failure occurs when `nbytes < 1` or `nbytes > 8` or `buf.len() < nbyte... | 1 | 30 | 18 |
f47b8100e283f028952d19fb943b30e580d2b466 | Andrew Gallant | 2015-03-07T15:03:34 | Disable debug for testing because of bug in rustc. Grrr. | diff --git a/Cargo.toml b/Cargo.toml
index 074bc56..0d25ea8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,9 @@ license = "Unlicense"
[lib]
name = "byteorder"
+[profile.test]
+debug = false
+
[dev-dependencies]
quickcheck = "*"
rand = "*" | 1 | 3 | 0 |
3e12a23511b188d58cf47ce9f7b3830755efdda1 | Steven Allen | 2015-03-07T01:55:53 | Retry on interrupt.
This is what Read::read_to_end does. | diff --git a/src/new.rs b/src/new.rs
index 504fd63..95b9385 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -184,9 +184,11 @@ impl<R: io::Read> ReadBytesExt for R {}
fn read_full<R: io::Read + ?Sized>(rdr: &mut R, buf: &mut [u8]) -> Result<()> {
let mut nread = 0usize;
while nread < buf.len() {
- match tr... | 1 | 5 | 3 |
028fd4a4082a703648e561b2cd314dfa86f81f72 | Andrew Robbins | 2015-03-04T16:10:24 | Published bswap to crates.io | diff --git a/Cargo.toml b/Cargo.toml
index 1f00b18..e6ec334 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,8 +13,8 @@ license = "Unlicense"
[lib]
name = "byteorder"
-[dependencies.bswap]
-git = "https://github.com/andydude/rust-bswap"
+[dependencies]
+bswap = "*"
[dev-dependencies]
quickcheck = "*" | 1 | 2 | 2 |
4f79af18fd3d285d22d01645f9d7efd3866c72b1 | blackbeam | 2015-02-28T11:09:22 | Remove Sized bound. Close #13 | diff --git a/src/new.rs b/src/new.rs
index e8ee1a6..504fd63 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -83,7 +83,7 @@ impl error::Error for Error {
/// assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap());
/// assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap());
/// ```
-pub trait ReadBytesExt: io::Read + Sized ... | 2 | 7 | 7 |
dc28fbdc73ad9b6f3a9cd9cd146cc58e62dfcf6d | Andrew Robbins | 2015-02-27T03:43:14 | Removed Sized requirement | diff --git a/src/new.rs b/src/new.rs
index c0bc8fe..e5e3723 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -83,7 +83,7 @@ impl error::Error for Error {
/// assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap());
/// assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap());
/// ```
-pub trait ReadBytesExt: io::Read + Sized ... | 1 | 4 | 4 |
6f77df50ec416827c803e622fb571db8704a93e0 | Andrew Robbins | 2015-02-27T03:03:05 | Fixed tests for strict assertions | diff --git a/src/lib.rs b/src/lib.rs
index 8259c96..3445e32 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -320,7 +320,7 @@ mod test {
fn prop(n: $ty_int) -> bool {
let mut buf = [0; 8];
<LittleEndian as ByteOrder>::$write(&mut buf, n);
- ... | 2 | 13 | 10 |
23294d539a18d2b5505c13a86773336991e0326a | Roman S. Borschel | 2015-02-25T08:58:49 | Unintrusive workaround for rust-lang/rust#22776. | diff --git a/src/lib.rs b/src/lib.rs
index 009a780..a19c81e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -265,8 +265,9 @@ macro_rules! write_num_bytes {
assert!($dst.len() >= $size); // critical for memory safety!
unsafe {
- let bytes = (&transmute::<_, [u8; $size]>($n.$which())).as_ptr();... | 1 | 3 | 2 |
718f3a8e0981e88189fbd7c35f3ed92104c32bae | Andrew Robbins | 2015-02-25T07:48:32 | Replaced read_num_bytes!/write_num_bytes! with rust-bswap decode/encode functions. | diff --git a/Cargo.toml b/Cargo.toml
index 0c2f56d..1f00b18 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,9 @@ license = "Unlicense"
[lib]
name = "byteorder"
+[dependencies.bswap]
+git = "https://github.com/andydude/rust-bswap"
+
[dev-dependencies]
quickcheck = "*"
rand = "*"
diff --git a/src/lib.rs b/sr... | 2 | 18 | 67 |
dc6a8670394134d1f4c831d1d04eddc476cf785e | blackbeam | 2015-02-23T07:00:44 | Implement `std::error::FromError<byteorder::Error>` for `std::io::Error` | diff --git a/src/new.rs b/src/new.rs
index 2d7e297..e8ee1a6 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -30,6 +30,16 @@ impl error::FromError<io::Error> for Error {
fn from_error(err: io::Error) -> Error { Error::Io(err) }
}
+impl error::FromError<Error> for io::Error {
+ fn from_error(err: Error) -> io::Err... | 1 | 10 | 0 |
ea6b26980c648142d10a5c5d19d2b095ea200537 | Fenhl | 2015-02-22T19:46:26 | Update crate documentation
Seems like this was missed. | diff --git a/src/lib.rs b/src/lib.rs
index 8371904..009a780 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -7,7 +7,7 @@ byte conversion methods for each type of number in Rust (sans numbers that have
a platform dependent size like `usize` and `isize`). Two types, `BigEndian`
and `LittleEndian` implement these methods. F... | 1 | 1 | 1 |
c35fc7c2caa633f61d92cc6bdd28521ae3c05fee | Andrew Gallant | 2015-02-21T16:07:32 | Adds an `Error` type for handling unexpected EOF.
This changes the return type of the various `read` and `write`
extension methods, so it's a
[breaking-change] | diff --git a/src/lib.rs b/src/lib.rs
index 8d26f43..8371904 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -51,10 +51,8 @@ assert_eq!(wtr, vec![5, 2, 0, 3]);
use std::mem::transmute;
-pub use new::ReadBytesExt;
-pub use new::WriteBytesExt;
-pub use old::ReaderBytesExt;
-pub use old::WriterBytesExt;
+pub use new::{Rea... | 2 | 98 | 40 |
001a41a3907f7398bdeabf38057466275d502547 | Andrew Gallant | 2015-02-21T04:15:38 | Hint at which trait is which. | diff --git a/src/new.rs b/src/new.rs
index 6903b17..d10bcf3 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -2,7 +2,7 @@ use std::io;
use ByteOrder;
-/// Extends `Read` with methods for reading numbers.
+/// Extends `Read` with methods for reading numbers. (For `std::io`.)
///
/// Most of the methods defined here ha... | 2 | 4 | 4 |
d3f22dc8a9c5c52ef16cb28ebc5e8262370592ca | Andrew Gallant | 2015-02-21T04:12:52 | Support std::io. | diff --git a/src/lib.rs b/src/lib.rs
index 1e4ec7b..8d26f43 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,35 +2,37 @@
This crate provides convenience methods for encoding and decoding numbers
in either big-endian or little-endian order.
-**Future plans:** Currently, this crate works with `std::old_io`. Once the
-n... | 3 | 478 | 250 |
973fbea15de7d3c5837e1e98be2b52d852d95579 | Cody P Schafer | 2015-02-20T22:03:07 | Add feature old_io to silence warnings | diff --git a/src/lib.rs b/src/lib.rs
index cb7052e..1e4ec7b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -45,7 +45,7 @@ assert_eq!(wtr, vec![5, 2, 0, 3]);
#![deny(missing_docs)]
#![allow(unused_features)] // for `rand` while testing
-#![feature(core, io, test)]
+#![feature(core, io, test, old_io)]
use std::old_io... | 1 | 1 | 1 |
eeb9b67c9f9a3e70d3ea6875c17029d44a22b191 | Cody P Schafer | 2015-02-20T19:54:01 | mark ByteOrder trait with MarkerTrait | diff --git a/src/lib.rs b/src/lib.rs
index d6c8ffd..cb7052e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -94,7 +94,7 @@ fn extend_sign(val: u64, nbytes: usize) -> i64 {
/// <BigEndian as ByteOrder>::write_i16(&mut buf, -50_000);
/// assert_eq!(-50_000, <BigEndian as ByteOrder>::read_i16(&buf));
/// ```
-pub trait Byt... | 1 | 1 | 1 |
6dc1d3349099c8409a3c5d72ffe90ac728d4069b | Cody P Schafer | 2015-02-20T18:30:04 | The "us" suffix was changed to "usize" | diff --git a/src/lib.rs b/src/lib.rs
index 17f1105..d6c8ffd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -325,7 +325,7 @@ pub trait ReaderBytesExt: Reader + Sized {
impl<R: Reader> ReaderBytesExt for R {}
fn read_full<R: Reader>(rdr: &mut R, buf: &mut [u8]) -> IoResult<()> {
- let mut n = 0us;
+ let mut n = 0u... | 1 | 1 | 1 |
c9e4e313f392409b46a2ca7abfeea98df14237b4 | blackbeam | 2015-02-15T15:16:13 | Add `read_uint` and `read_int` | diff --git a/src/lib.rs b/src/lib.rs
index 16c3390..7d6fe5e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -59,6 +59,11 @@ macro_rules! lg {
});
}
+fn extend_sign(val: u64, nbytes: usize) -> i64 {
+ let shift = (8 - nbytes) * 8;
+ (val << shift) as i64 >> shift
+}
+
/// ByteOrder describes types that can s... | 1 | 247 | 0 |
4119281d75f9858798c791eac22d9746b0ba015f | Andrew Gallant | 2015-02-06T00:02:01 | slight style tweak | diff --git a/src/lib.rs b/src/lib.rs
index fc450ce..16c3390 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -75,9 +75,9 @@ macro_rules! lg {
/// ```rust
/// use byteorder::{ByteOrder, LittleEndian};
///
-/// let buf = &mut [0; 4];
-/// <LittleEndian as ByteOrder>::write_u32(buf, 1_000_000);
-/// assert_eq!(1_000_000, <L... | 1 | 64 | 64 |
d3f51806dbc8a42c0202845b1f23ee86a58df962 | Andrew Gallant | 2015-02-05T23:43:53 | remove 'rand' feature | diff --git a/src/lib.rs b/src/lib.rs
index a7bb464..fc450ce 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -45,7 +45,7 @@ assert_eq!(wtr, vec![5, 2, 0, 3]);
#![deny(missing_docs)]
#![allow(unused_features)] // for `rand` while testing
-#![feature(core, io, rand, test)]
+#![feature(core, io, test)]
use std::old_io::... | 1 | 1 | 1 |
24d51df81bd15df95b3053a397577c2bebe23e6b | Andrew Gallant | 2015-02-05T23:40:25 | Floating point, docs and more tests. | diff --git a/src/lib.rs b/src/lib.rs
index 5c26ae2..a7bb464 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,42 @@
/*!
This crate provides convenience methods for encoding and decoding numbers
in either big-endian or little-endian order.
+
+**Future plans:** Currently, this crate works with `std::old_io`. Once th... | 1 | 192 | 30 |
9d3c94e8575dae15c3c7e472c8e5ca2f83e96f23 | Andrew Gallant | 2015-02-05T01:50:58 | Docs. Tests. Benchmarks. | diff --git a/src/lib.rs b/src/lib.rs
index 4605ff2..8351604 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,8 +1,15 @@
+/*!
+This crate provides convenience methods for encoding and decoding numbers
+in either big-endian or little-endian order.
+*/
+
#![crate_name = "byteorder"]
#![doc(html_root_url = "http://burntsus... | 1 | 399 | 138 |
77dcefddad5a0cfafd70bf20e0047fa9581266da | Steven Fackler | 2015-02-04T07:29:08 | Make order markers uninstantiable | diff --git a/src/lib.rs b/src/lib.rs
index 4605ff2..8c19d7b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -156,8 +156,8 @@ pub trait WriterBytesExt: Writer + Sized {
impl<W: Writer> WriterBytesExt for W {}
-#[allow(missing_copy_implementations)] pub struct BigEndian;
-#[allow(missing_copy_implementations)] pub struc... | 1 | 2 | 2 |
b55399d24a9b4036e77a619c0539c9ed319608f2 | Andrew Gallant | 2015-02-04T01:56:08 | First draft. No docs and testing could be better. | diff --git a/Cargo.toml b/Cargo.toml
index 8655c73..1a13e22 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,3 +12,6 @@ license = "Unlicense"
[lib]
name = "byteorder"
+
+[dev-dependencies]
+quickcheck = "*"
diff --git a/src/lib.rs b/src/lib.rs
index 97d6694..4605ff2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +... | 2 | 295 | 0 |
9aaed19e0fcc3ce03a30afd8623828f6120a0184 | Nick Pillitteri | 2026-04-11T14:09:24 | Use resolving behavior in integration tests
This changes the UDP sinks in integration test to use the re-resolving
behavior. Also add an example of how to configure sinks to use this
in the examples directory.
Related #236 #222 | diff --git a/cadence/examples/resolving-udp-sink.rs b/cadence/examples/resolving-udp-sink.rs
new file mode 100644
index 0000000..b4ec533
--- /dev/null
+++ b/cadence/examples/resolving-udp-sink.rs
@@ -0,0 +1,43 @@
+// Cadence - An extensible Statsd client for Rust!
+//
+// To the extent possible under law, the author(s)... | 2 | 52 | 4 |
b497cd575638c409e9ca87139b0cb289a65881aa | Nick Pillitteri | 2026-02-21T03:09:23 | chore: extract `QueuingMetricSink` thread logic
Extract the logic for spawning a task in a new thread into a
module so that it can be reused. Prerequisite for doing periodic
DNS lookups for #222. | diff --git a/cadence/src/lib.rs b/cadence/src/lib.rs
index c929c2e..6ed3fbd 100644
--- a/cadence/src/lib.rs
+++ b/cadence/src/lib.rs
@@ -536,6 +536,7 @@ pub mod ext;
mod io;
pub mod prelude;
mod sinks;
+mod sync;
mod types;
// Utilities for running integration tests with Unix datagram sockets.
diff --git a/caden... | 3 | 126 | 78 |
9369dc7ac8877b55ce28428e8e867b5e17f8c3bc | Daniel Norberg | 2026-01-10T21:01:07 | Revert "Merge pull request #216 from dwhjames/drop_adapter_stats"
This reverts commit 9a2287bcafbff5ab5d16195ebc479ee5406b9b8b, reversing
changes made to acfccec44f199363ff6cc7d33ed91529c5bf2e8f. | diff --git a/cadence/src/sinks/udp.rs b/cadence/src/sinks/udp.rs
index 12c7db6..5992740 100644
--- a/cadence/src/sinks/udp.rs
+++ b/cadence/src/sinks/udp.rs
@@ -125,17 +125,18 @@ impl MetricSink for UdpMetricSink {
pub(crate) struct UdpWriteAdapter {
addr: SocketAddr,
socket: UdpSocket,
+ stats: SocketSta... | 1 | 10 | 5 |
7f02b4c19927894f69e085e529886604b8babb56 | Daniel Norberg | 2026-01-10T21:12:05 | Add test for BufferedUdpMetricSink stats | diff --git a/cadence/src/sinks/udp.rs b/cadence/src/sinks/udp.rs
index 54b07cb..12c7db6 100644
--- a/cadence/src/sinks/udp.rs
+++ b/cadence/src/sinks/udp.rs
@@ -322,4 +322,26 @@ mod tests {
assert_eq!(8, sink.emit("foo:54|c").unwrap());
assert!(sink.flush().is_ok());
}
+
+ #[test]
+ fn test... | 1 | 22 | 0 |
791fa0923692e1087cd15d1034b4d2ba3f4ab21a | Daniel James | 2025-06-01T05:30:32 | Add replace_writer method to MultiLineWriter
The motivation for this change is to implement connection-oriented,
stateful sinks (Virtio/vsock, or TCP).
To enable connection recovery with `MultiLineWriter`, there is a need
to replace the underlying writer. This interface also exposes the
state of the replaced underlyi... | diff --git a/cadence/src/io.rs b/cadence/src/io.rs
index 9853326..d0883bf 100644
--- a/cadence/src/io.rs
+++ b/cadence/src/io.rs
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::io;
+use std::io::{self, WriterPanicked};
use std::io::{Buf... | 1 | 169 | 5 |
1a1b7375fae1e02e70e4936a48505bfa5d23578b | Daniel James | 2025-06-01T06:35:10 | Remove SocketStats from UdpWriteAdapter
These SocketStats were written to, but never read. The SocketStats on
BufferedUdpMetricSink are the ones that are relevant. | diff --git a/cadence/src/sinks/udp.rs b/cadence/src/sinks/udp.rs
index 41ce6d8..54b07cb 100644
--- a/cadence/src/sinks/udp.rs
+++ b/cadence/src/sinks/udp.rs
@@ -125,18 +125,17 @@ impl MetricSink for UdpMetricSink {
pub(crate) struct UdpWriteAdapter {
addr: SocketAddr,
socket: UdpSocket,
- stats: SocketSta... | 1 | 5 | 10 |
c6a651fe0770424c71ddddaa5c935e6e461c8c3a | Daniel James | 2025-06-03T05:30:49 | Allow uninlined format args at crate level
Project preference for uninlined format args. | diff --git a/cadence/src/lib.rs b/cadence/src/lib.rs
index ddb511a..c929c2e 100644
--- a/cadence/src/lib.rs
+++ b/cadence/src/lib.rs
@@ -510,6 +510,7 @@
//!
#![forbid(unsafe_code)]
+#![allow(clippy::uninlined_format_args)]
pub const DEFAULT_PORT: u16 = 8125; | 1 | 1 | 0 |
13c0c2df94be9f2f2ec15ff94323adde8e664058 | Daniel James | 2025-06-01T09:11:18 | Fix out-of-order, buffered writes
Out-of-order writes are possible if a large message (which exceeds
buffer capacity) comes after one or more small messages (which remain
in the buffer).
Issue maybe originates/relates to
- https://github.com/56quarters/cadence/issues/59
- https://github.com/56quarters/cadence/pull/... | diff --git a/cadence/src/io.rs b/cadence/src/io.rs
index ee23369..9853326 100644
--- a/cadence/src/io.rs
+++ b/cadence/src/io.rs
@@ -77,6 +77,10 @@ where
let required = buf.len() + self.line_ending.len();
if required > self.capacity {
+ // if buffer non-empty, flush to preserve ordering.
... | 1 | 42 | 0 |
6721d030e50d3f29d10894eab202f7226dad399c | Daniel James | 2025-06-01T06:50:05 | Fix warnings from cargo clippy
- elided lifetime warnings in client.rs
- implicity_saturating_sub warning in queuing.rs
- ignore io_other_error warnings in queuing.rs and spy.rs to keep
MSRV at 1.60 | diff --git a/cadence/src/client.rs b/cadence/src/client.rs
index bef910e..3bcfed2 100644
--- a/cadence/src/client.rs
+++ b/cadence/src/client.rs
@@ -282,7 +282,7 @@ where
/// Increment or decrement the counter by the given amount and return
/// a `MetricBuilder` that can be used to add tags to the metric.
-... | 3 | 23 | 21 |
55116015eabb282114c967fb76ccc415da1ce9bf | Corentin Chary | 2024-09-26T07:09:22 | Use ToString for `with_container_id` | diff --git a/cadence/src/client.rs b/cadence/src/client.rs
index cb1fe0f..bef910e 100644
--- a/cadence/src/client.rs
+++ b/cadence/src/client.rs
@@ -736,7 +736,10 @@ impl StatsdClientBuilder {
/// Add a default container ID to every metric published by the built
/// [StatsdClient].
- pub fn with_containe... | 1 | 4 | 1 |
0cc9c1a0af51a6e315fa679bee2e4398c0ec8c7a | Corentin Chary | 2024-09-25T07:36:37 | Fix tests | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index 055e677..52d5fc0 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -807,7 +807,7 @@ mod tests {
let expected = "prefix.some.key:44:45:46|d|@0.5";
assert_eq!(expected, &fmt.format());
- assert_eq!(61, fmt.size... | 1 | 2 | 2 |
9d7f7f7b2e6f0c0c1927d69bbe9d87288e31dfc5 | Corentin Chary | 2024-09-25T07:33:59 | sampling rate: cleanup the code | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index 468448f..055e677 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -248,7 +248,7 @@ impl<'a> MetricFormatter<'a> {
fn sampling_rate_size_hint(&self) -> usize {
if let Some(_rate) = self.sampling_rate {
/* |@ ... | 1 | 7 | 1 |
77cc15c216185f7af6ed123687066aa875248e8f | Corentin Chary | 2024-09-25T07:20:53 | Update cadence/src/builder.rs
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com> | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index 5ba873e..468448f 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -478,7 +478,7 @@ where
self
}
- /// Add a timestamp to this metric.
+ /// Add a UNIX timestamp in seconds to this metric.
/// # Example
... | 1 | 1 | 1 |
f8239f21087bcc1d33eb4f65802f889ed8fac6f7 | Nick Pillitteri | 2024-09-24T23:46:24 | Remove use of legacy numeric constant | diff --git a/cadence/src/client.rs b/cadence/src/client.rs
index 6cdc5ac..4ff1743 100644
--- a/cadence/src/client.rs
+++ b/cadence/src/client.rs
@@ -17,7 +17,6 @@ use crate::types::{
use std::fmt;
use std::panic::RefUnwindSafe;
use std::time::Duration;
-use std::u64;
/// Conversion trait for valid values for coun... | 1 | 0 | 2 |
c8f865662b5763f56d8775caf6dcf19836bd882f | Corentin Chary | 2024-09-24T09:42:36 | fix doctests | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index ecd74cc..5ba873e 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -493,7 +493,7 @@ where
/// .try_send();
///
/// assert_eq!(
- /// "some.prefix.some.key:1|c|t:timestamp",
+ /// "some.prefix.some.key:1|c|T".... | 1 | 3 | 3 |
98e6df72a6dd2d461013ee0af1f17d2251391c31 | Corentin Chary | 2024-09-24T09:26:19 | builder: fix new tests | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index 5148996..ecd74cc 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -801,7 +801,7 @@ mod tests {
let expected = "prefix.some.key:44:45:46|d|@0.5";
assert_eq!(expected, &fmt.format());
- assert_eq!(41, fmt.size... | 1 | 2 | 2 |
1d84f176c29b43cc403b161784a0d02fcc524912 | Nick Pillitteri | 2024-05-02T23:41:10 | Use appropriate atomic ordering for macro state
Switch ordering used for `compare_exchange` when setting global macro state.
Use `AcqRel` for success to create an ordering relationship with reads from
the method `is_set` or other calls of `set`. Use and `Relaxed` for failure
because we don't care about the value when ... | diff --git a/cadence-macros/src/state.rs b/cadence-macros/src/state.rs
index 6b73587..5bb6bc1 100644
--- a/cadence-macros/src/state.rs
+++ b/cadence-macros/src/state.rs
@@ -29,7 +29,7 @@ static HOLDER: SingletonHolder<StatsdClient> = SingletonHolder::new();
/// this crate but it is not part of the public API and may c... | 2 | 21 | 21 |
972d9e0fde1a95302b00f616bcd0e2d4f7c35114 | Nick Pillitteri | 2024-04-28T23:17:32 | Replace use of deprecated AtomicUsize::compare_and_swap
Deprecated since Rust 1.50 but we only support 1.60 now. | diff --git a/cadence-macros/src/state.rs b/cadence-macros/src/state.rs
index dea83de..6b73587 100644
--- a/cadence-macros/src/state.rs
+++ b/cadence-macros/src/state.rs
@@ -62,10 +62,12 @@ impl<T> SingletonHolder<T> {
}
/// Set the value if it has not already been set, otherwise this is a no-op
- #[allow... | 1 | 5 | 3 |
2a1fb95383881797569a370a1ae3775d02671b83 | Michał Łowicki | 2024-04-25T07:19:31 | do not make core mod public | diff --git a/cadence/src/ext.rs b/cadence/src/ext.rs
index b9a4d17..58483bf 100644
--- a/cadence/src/ext.rs
+++ b/cadence/src/ext.rs
@@ -34,4 +34,4 @@ pub use crate::client::{
ToTimerValue,
};
pub use crate::io::MultiLineWriter;
-pub use crate::sinks::core::SocketStats;
+pub use crate::sinks::SocketStats;
diff -... | 2 | 3 | 3 |
2cdc77c69dd21753fe89b14cd5ef39a1be4cb644 | Michał Łowicki | 2024-04-24T13:01:28 | Expose more things for more advanced sink impl cases | diff --git a/cadence/src/ext.rs b/cadence/src/ext.rs
index 0989d67..b9a4d17 100644
--- a/cadence/src/ext.rs
+++ b/cadence/src/ext.rs
@@ -33,3 +33,5 @@ pub use crate::client::{
MetricBackend, ToCounterValue, ToDistributionValue, ToGaugeValue, ToHistogramValue, ToMeterValue, ToSetValue,
ToTimerValue,
};
+pub u... | 4 | 12 | 10 |
96e345f5bfa97002d142cef313d0f70ce994dfe8 | Nick Pillitteri | 2024-03-23T11:56:10 | Clippy fix | diff --git a/cadence/src/sinks/queuing.rs b/cadence/src/sinks/queuing.rs
index ee159cb..64e4351 100644
--- a/cadence/src/sinks/queuing.rs
+++ b/cadence/src/sinks/queuing.rs
@@ -705,7 +705,7 @@ mod tests {
}
let queueing = QueuingMetricSink::with_capacity(BlockingMetricSink, 1);
- let results ... | 1 | 1 | 1 |
4c147ade0eeb8bc09944bde150185d9872a871d1 | Michał Łowicki | 2024-03-21T12:04:01 | Network-level telemetry via sink stats (#203) | diff --git a/cadence/src/lib.rs b/cadence/src/lib.rs
index b3deab0..ddb511a 100644
--- a/cadence/src/lib.rs
+++ b/cadence/src/lib.rs
@@ -522,7 +522,7 @@ pub use self::client::{
pub use self::sinks::{
BufferedSpyMetricSink, BufferedUdpMetricSink, MetricSink, NopMetricSink, QueuingMetricSink,
- QueuingMetricSi... | 6 | 129 | 15 |
d46548219f2f2b6ad06e9c2b7d2ab6aea2cb94ae | James Bartman | 2024-03-20T22:54:43 | `StatsdClient` flush functionality (#200) | diff --git a/cadence/src/client.rs b/cadence/src/client.rs
index f300e36..0be696a 100644
--- a/cadence/src/client.rs
+++ b/cadence/src/client.rs
@@ -933,6 +933,40 @@ impl StatsdClient {
StatsdClientBuilder::new(prefix, sink)
}
+ /// Flush the underlying metric sink.
+ ///
+ /// This is helpful ... | 1 | 34 | 0 |
63c32684b7b4c624b7e05fb1ce997d4a3113e13e | James Bartman | 2024-03-09T14:52:11 | Add ToCounterValue and Counted impls for u64 u32 i32 (#201) | diff --git a/cadence/src/client.rs b/cadence/src/client.rs
index 313676a..514a192 100644
--- a/cadence/src/client.rs
+++ b/cadence/src/client.rs
@@ -22,7 +22,7 @@ use std::u64;
/// Conversion trait for valid values for counters
///
/// This trait must be implemented for any types that are used as counter
-/// values... | 1 | 50 | 3 |
0a47cafd19501d7bbdbf959daadf21034926bf87 | Michał Łowicki | 2024-02-17T23:27:36 | Add optional error handler for QueuingMetricSink (#195)
Fixes #194 | diff --git a/cadence/src/lib.rs b/cadence/src/lib.rs
index 6e41bea..b497bbe 100644
--- a/cadence/src/lib.rs
+++ b/cadence/src/lib.rs
@@ -491,8 +491,8 @@ pub use self::client::{
};
pub use self::sinks::{
- BufferedSpyMetricSink, BufferedUdpMetricSink, MetricSink, NopMetricSink, QueuingMetricSink, SpyMetricSink,
-... | 3 | 79 | 20 |
dbb7dfca28611faa1799ffaadba4be1e6330e59b | Michał Łowicki | 2024-02-02T08:25:04 | Impl flush for QueuingMetricSink | diff --git a/cadence/src/sinks/queuing.rs b/cadence/src/sinks/queuing.rs
index 123541f..3041dbf 100644
--- a/cadence/src/sinks/queuing.rs
+++ b/cadence/src/sinks/queuing.rs
@@ -64,9 +64,16 @@ use std::thread;
/// At the end of this code block, all metrics are guaranteed to be sent to
/// the underlying wrapped metric... | 1 | 16 | 3 |
9b4595687ba4dc5151390dd9a5678679976964e5 | Daniel Tai | 2023-05-22T05:55:18 | Fix missing StatsdClient tags for distribution | diff --git a/cadence/src/client.rs b/cadence/src/client.rs
index ae7a30b..313676a 100644
--- a/cadence/src/client.rs
+++ b/cadence/src/client.rs
@@ -1022,7 +1022,8 @@ where
{
fn distribution_with_tags<'a>(&'a self, key: &'a str, value: T) -> MetricBuilder<'_, '_, Distribution> {
match value.try_to_value(... | 1 | 19 | 1 |
c1db3158f148ea68aa8b0ddb44349238fffbcfd7 | Nick Pillitteri | 2022-09-25T17:21:16 | Fix clippy warning after 2021 edition update | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index 82f66c9..2abb1db 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -84,7 +84,7 @@ where
impl fmt::Display for MetricValue {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- match &*self {
+ match self ... | 1 | 1 | 1 |
dbf3e6871a23ac30c438d109c23a0c9e8503fcb5 | Nick Pillitteri | 2022-08-01T19:17:56 | Add cloneable wrapper MetricSink example.
Add example of how to retain a reference to a wrapped sink such
that its flush method can be periodically called. This exists to
document how users to Cadence could call any lifecycle methods on
a wrapped sink required. | diff --git a/cadence/examples/custom-value-type.rs b/cadence/examples/custom-value-type.rs
index cf05c03..62c483e 100644
--- a/cadence/examples/custom-value-type.rs
+++ b/cadence/examples/custom-value-type.rs
@@ -34,9 +34,9 @@ impl ToGaugeValue for UserHappiness {
fn main() {
let sink = NopMetricSink;
- let ... | 8 | 148 | 82 |
5c283f894c9d4d5879ba43b71ef2a701c59a0762 | Luke Francl | 2022-03-28T14:14:44 | Add default tags via new methods on StatsdClientBuilder (#172)
This change adds support for default tags by adding `with_tag` and `with_tag_value` methods
to `StatsdClientBuilder` so that the built client adds the tags to all emitted metrics. It supports
all metric types, adds tests for default tags, and updates doc... | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index ee6bae1..82f66c9 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -365,6 +365,23 @@ where
self
}
+ /// Add tags to this metric.
+ pub(crate) fn with_tags<V>(mut self, tags: V) -> Self
+ where
+ V: IntoI... | 2 | 171 | 9 |
a6432b9457ad14eeab6bc26b44a06ee92178ea3d | Nick Pillitteri | 2022-01-29T04:25:52 | Dependency update for 0.28 | diff --git a/cadence-macros/Cargo.toml b/cadence-macros/Cargo.toml
index f998b70..5e84435 100644
--- a/cadence-macros/Cargo.toml
+++ b/cadence-macros/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cadence-macros"
-version = "0.27.0"
+version = "0.28.0"
authors = ["Nick Pillitteri"]
description = "Macros for Cadence, ... | 1 | 1 | 1 |
cb86507f477d826a13ab496738bad4c9c1b2ad34 | Nick Pillitteri | 2021-10-14T01:27:18 | Crossbeam version bump | diff --git a/cadence-macros/Cargo.toml b/cadence-macros/Cargo.toml
index 8e670fe..a116a4e 100644
--- a/cadence-macros/Cargo.toml
+++ b/cadence-macros/Cargo.toml
@@ -16,4 +16,4 @@ autobenches = false
cadence = { path = "../cadence", version = "0.26" }
[dev-dependencies]
-crossbeam-channel = "0.5.0"
+crossbeam-channe... | 2 | 2 | 2 |
fcd4c62c168fe64ee55336f90130be78f1b52a84 | Nick Pillitteri | 2021-10-14T00:20:59 | Include distribution example | diff --git a/cadence/src/prelude.rs b/cadence/src/prelude.rs
index 29e74b9..c63c137 100644
--- a/cadence/src/prelude.rs
+++ b/cadence/src/prelude.rs
@@ -24,6 +24,7 @@
//! client.meter("some.meter", 67).unwrap();
//! client.histogram("some.histogram", 89).unwrap();
//! client.set("some.set", 123).unwrap();
+//! clien... | 1 | 1 | 0 |
62806f76a404faa67745861dec1b0d94f9d3fc30 | Nick Pillitteri | 2021-10-06T02:10:36 | Minor sinks/core cleanup | diff --git a/cadence/src/sinks/core.rs b/cadence/src/sinks/core.rs
index 0c7ec99..f791448 100644
--- a/cadence/src/sinks/core.rs
+++ b/cadence/src/sinks/core.rs
@@ -52,6 +52,12 @@ use std::io;
/// some.set:2|s
/// ```
///
+/// ## Distribution
+///
+/// ``` text
+/// some.distribution:2|d
+/// ```
+///
/// See the [... | 1 | 7 | 2 |
9ecf3a2f2f0fc3c075c85fe7d9becf0ce51e6d5b | Nick Pillitteri | 2021-09-24T18:07:08 | Create panicking and error test sinks | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index 161f465..293f0cf 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -407,7 +407,13 @@ where
#[cfg(test)]
mod tests {
- use super::{MetricFormatter, MetricValue};
+ use super::{MetricBuilder, MetricFormatter, MetricValue};
+ ... | 3 | 148 | 93 |
5539d2415319c6198ef443ae14cd9d0a9328b4d2 | Nick Pillitteri | 2021-09-11T23:43:51 | Remove internal use of Arc from StatsdClient
Remove Arcs used only so the client could implement the Clone trait. Instead
they are replaced with Boxes which don't require reference counting. The
implication of this is that users of StatsdClient must wrap it in an Arc if
they wish to share references of it between thre... | diff --git a/cadence/examples/unwrapped-client.rs b/cadence/examples/unwrapped-client.rs
deleted file mode 100644
index 86958fe..0000000
--- a/cadence/examples/unwrapped-client.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Cadence - An extensible Statsd client for Rust!
-//
-// To the extent possible under law, the author(s) h... | 2 | 14 | 111 |
6a6d1b2355c9c617978f1066fdf717535fd6a468 | Nick Pillitteri | 2021-09-11T13:46:50 | Check tag vector instead of kv length | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index d75c1cf..161f465 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -155,7 +155,7 @@ impl<'a> MetricFormatter<'a> {
}
fn tag_size_hint(&self) -> usize {
- if self.kv_size == 0 {
+ if self.tags.is_empty() {
... | 1 | 1 | 1 |
3dd0d638c187e7cfbf75e33092c39fd945c7a0cb | Nick Pillitteri | 2021-09-09T03:02:33 | Keep track of space required as metrics are built
Keep track of the number of bytes required to represent a metric as
tags are being added to it instead of looping through all the tags
just before doing an allocation to compute the space required. | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index 5569fef..d75c1cf 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -71,6 +71,8 @@ pub(crate) struct MetricFormatter<'a> {
val: MetricValue,
type_: MetricType,
tags: Vec<(Option<&'a str>, &'a str)>,
+ base_size: usize,... | 1 | 15 | 25 |
91bb5d77d9b8b7eb3b2ea7ea442661c23afd6ab2 | Nick Pillitteri | 2021-08-19T23:06:03 | Create integration tests to verify heap allocations
Create integration tests to verify how many heap allocations are done
when using the QueuingMetricSink, with and without tags. This ensures
that we don't accidentally drastically alter the behavior of the
library.
Fixes #158 | diff --git a/cadence/tests/alloc-no-tags.rs b/cadence/tests/alloc-no-tags.rs
new file mode 100644
index 0000000..e352e9d
--- /dev/null
+++ b/cadence/tests/alloc-no-tags.rs
@@ -0,0 +1,25 @@
+use cadence::prelude::*;
+use cadence::{NopMetricSink, QueuingMetricSink, StatsdClient};
+use utils::InstrumentedAllocator;
+
+mod... | 7 | 113 | 5 |
afd85eb890a7ff879fa28ed020f45616fb91770b | Nick Pillitteri | 2021-08-19T23:56:14 | Disable criterion benchmarks
At the time it was added, Criterion was the only way to benchmark on
stable Rust. While useful, the number of dependencies it pulls it makes
it very difficult to support older versions of Rust.
Disable benchmarks until such time as our MSRV works with the various
dependencies Criterion pu... | diff --git a/cadence-macros/Cargo.toml b/cadence-macros/Cargo.toml
index ec18fd0..8e670fe 100644
--- a/cadence-macros/Cargo.toml
+++ b/cadence-macros/Cargo.toml
@@ -16,9 +16,4 @@ autobenches = false
cadence = { path = "../cadence", version = "0.26" }
[dev-dependencies]
-criterion = "=0.3.4"
crossbeam-channel = "0.... | 2 | 0 | 11 |
c17d87f6832d6bd09e56eaa29a80e3774b196fcb | Nick Pillitteri | 2021-08-04T19:46:26 | Clippy fixes and style cleanup (#156) | diff --git a/cadence/examples/arc-wrapped-client.rs b/cadence/examples/arc-wrapped-client.rs
index 7f394c9..cf2f42e 100644
--- a/cadence/examples/arc-wrapped-client.rs
+++ b/cadence/examples/arc-wrapped-client.rs
@@ -34,7 +34,7 @@ impl ThreadedHandler {
impl RequestHandler for ThreadedHandler {
fn handle(&self)... | 7 | 19 | 21 |
6f6645a78d43c99bd31386b215cdaea346e750fd | Nick Pillitteri | 2021-08-03T02:15:15 | Lint fixes (#155)
Lint fixes and pin to specific version of Criterion | diff --git a/cadence-macros/Cargo.toml b/cadence-macros/Cargo.toml
index 31fe6de..ec18fd0 100644
--- a/cadence-macros/Cargo.toml
+++ b/cadence-macros/Cargo.toml
@@ -16,7 +16,7 @@ autobenches = false
cadence = { path = "../cadence", version = "0.26" }
[dev-dependencies]
-criterion = "0.3.1"
+criterion = "=0.3.4"
cr... | 4 | 18 | 18 |
d8493976c21addb628b933dec8297b6d7c639362 | Nick Pillitteri | 2021-07-17T01:05:29 | Example of using a custom type for a metric value
Fixes #151 | diff --git a/cadence/examples/custom-value-type.rs b/cadence/examples/custom-value-type.rs
new file mode 100644
index 0000000..cf05c03
--- /dev/null
+++ b/cadence/examples/custom-value-type.rs
@@ -0,0 +1,42 @@
+// Cadence - An extensible Statsd client for Rust!
+//
+// To the extent possible under law, the author(s) ha... | 1 | 42 | 0 |
8047ffe610839f1066e16d0aa5b9f9e54804bda7 | Nick Pillitteri | 2021-06-27T14:35:06 | Update list of types available for each metric type | diff --git a/cadence/src/client.rs b/cadence/src/client.rs
index 8f1634c..2b2a9ee 100644
--- a/cadence/src/client.rs
+++ b/cadence/src/client.rs
@@ -113,9 +113,9 @@ impl ToMeterValue for u64 {
/// Conversion trait for valid values for histograms
///
/// This trait must be implemented for any types that are used as h... | 1 | 4 | 4 |
2b51178dcd641520609958a58bee62c2650190f3 | Nick Pillitteri | 2021-05-14T01:58:09 | Cleanup imports | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index a61492c..5569fef 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -417,8 +417,7 @@ where
#[cfg(test)]
mod tests {
- use super::MetricFormatter;
- use crate::builder::MetricValue;
+ use super::{MetricFormatter, MetricValue... | 1 | 1 | 2 |
95ec173b95216e1fff70484a5c71519cd4d58fdd | Nick Pillitteri | 2021-05-12T12:29:27 | Include each type (u64, f64, Duration) for each method in examples
Fixes #145 | diff --git a/cadence-macros/examples/production-setup.rs b/cadence-macros/examples/production-setup.rs
index 6cecef7..25b159a 100644
--- a/cadence-macros/examples/production-setup.rs
+++ b/cadence-macros/examples/production-setup.rs
@@ -12,6 +12,7 @@ use cadence_macros::{
statsd_count, statsd_distribution, statsd_... | 8 | 62 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.