Skip to content
Draft
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions src/decoder_result.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::rate::DecoderWork;
use std::mem::take;

// ======================================================================
// DecoderResult - PUBLIC
Expand Down Expand Up @@ -27,6 +28,15 @@ impl<'a> DecoderResult<'a> {
pub fn restored_original_iter(&self) -> RestoredOriginal {
RestoredOriginal::new(self.work)
}

/// Returns inner Vec
pub fn into_inner_vec(self) -> Vec<u8> {
let data = take(&mut self.work.shards.data);
//TODO: truncate
//data.truncate(self.
self.work.reset_received();
data
}
}

// ======================================================================
Expand Down
2 changes: 1 addition & 1 deletion src/engine/shards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub(crate) struct Shards {
shard_bytes: usize,

// Flat array of `shard_count * shard_bytes` bytes.
data: Vec<u8>,
pub(crate) data: Vec<u8>,
}

impl Shards {
Expand Down
2 changes: 1 addition & 1 deletion src/rate/decoder_work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct DecoderWork {
recovery_received_count: usize,
// May contain extra zero bits.
received: FixedBitSet,
shards: Shards,
pub(crate) shards: Shards,
}

impl DecoderWork {
Expand Down