Skip to content

Commit

Permalink
Merge branch 'main' into cijothomas/user_events_release
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas authored Feb 14, 2024
2 parents 039ef7e + e422fbe commit 8b6ac1d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions opentelemetry-contrib/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## vNext

### Changed

- Update `BinaryFormat::deserialize_from_bytes` to take a byte slice instead of a Vec [#32](https://github.com/open-telemetry/opentelemetry-rust-contrib/pull/32)

## v0.13.0

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where

fn deserialize_from_base64(&self, base64: &str) -> SpanContext {
if let Ok(bytes) = decode(base64.as_bytes()) {
self.deserialize_from_bytes(bytes)
self.deserialize_from_bytes(&bytes)
} else {
SpanContext::empty_context()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub trait BinaryFormat {
fn serialize_into_bytes(&self, context: &SpanContext) -> [u8; 29];

/// Deserializes a span context from a byte array.
fn deserialize_from_bytes(&self, bytes: Vec<u8>) -> SpanContext;
fn deserialize_from_bytes(&self, bytes: &[u8]) -> SpanContext;
}

/// Extracts and injects `SpanContext`s from byte arrays.
Expand Down Expand Up @@ -46,7 +46,7 @@ impl BinaryFormat for BinaryPropagator {
}

/// Deserializes a span context from a byte array.
fn deserialize_from_bytes(&self, bytes: Vec<u8>) -> SpanContext {
fn deserialize_from_bytes(&self, bytes: &[u8]) -> SpanContext {
if bytes.is_empty() {
return SpanContext::empty_context();
}
Expand Down Expand Up @@ -172,7 +172,7 @@ mod tests {
let propagator = BinaryPropagator::new();

for (context, data) in from_bytes_data() {
assert_eq!(propagator.deserialize_from_bytes(data), context)
assert_eq!(propagator.deserialize_from_bytes(&data), context)
}
}
}

0 comments on commit 8b6ac1d

Please sign in to comment.