Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions opentelemetry-sdk/src/export/logs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub struct LogBatch<'a> {
/// - Or it can be a shared reference to a slice of tuples, where each tuple consists of a reference to a `LogRecord` and a reference to an `InstrumentationScope`.
#[derive(Debug)]
enum LogBatchData<'a> {
BorrowedVec(&'a [Box<(LogRecord, InstrumentationScope)>]), // Used by BatchProcessor which clones the LogRecords for its own use.
BorrowedSlice(&'a [(&'a LogRecord, &'a InstrumentationScope)]),
SliceOfOwnedData(&'a [Box<(LogRecord, InstrumentationScope)>]), // Used by BatchProcessor which clones the LogRecords for its own use.
SliceOfBorrowedData(&'a [(&'a LogRecord, &'a InstrumentationScope)]),
}

impl<'a> LogBatch<'a> {
Expand All @@ -48,15 +48,15 @@ impl<'a> LogBatch<'a> {
/// made private in the future.
pub fn new(data: &'a [(&'a LogRecord, &'a InstrumentationScope)]) -> LogBatch<'a> {
LogBatch {
data: LogBatchData::BorrowedSlice(data),
data: LogBatchData::SliceOfBorrowedData(data),
}
}

pub(crate) fn new_with_owned_data(
data: &'a [Box<(LogRecord, InstrumentationScope)>],
) -> LogBatch<'a> {
LogBatch {
data: LogBatchData::BorrowedVec(data),
data: LogBatchData::SliceOfOwnedData(data),
}
}
}
Expand Down Expand Up @@ -89,7 +89,7 @@ impl<'a> Iterator for LogBatchDataIter<'a> {

fn next(&mut self) -> Option<Self::Item> {
match self.data {
LogBatchData::BorrowedVec(data) => {
LogBatchData::SliceOfOwnedData(data) => {
if self.index < data.len() {
let record = &*data[self.index];
self.index += 1;
Expand All @@ -98,7 +98,7 @@ impl<'a> Iterator for LogBatchDataIter<'a> {
None
}
}
LogBatchData::BorrowedSlice(data) => {
LogBatchData::SliceOfBorrowedData(data) => {
if self.index < data.len() {
let record = &data[self.index];
self.index += 1;
Expand Down
Loading