| Crates.io | bitcoin-vectorstream |
| lib.rs | bitcoin-vectorstream |
| version | 0.1.18 |
| created_at | 2025-07-09 01:43:35.11385+00 |
| updated_at | 2025-07-09 01:43:35.11385+00 |
| description | minimal stream for reading from an existing vector by reference. It is designed for scenarios where efficient deserialization from a byte vector is required. |
| homepage | |
| repository | https://github.com/klebs6/bitcoin-rs |
| max_upload_size | |
| id | 1743883 |
| size | 193,383 |
bitcoin-vectorstream is a Rust crate providing a minimal stream for reading from an existing vector by reference. It is designed for scenarios where efficient deserialization from a byte vector is required.
This crate defines a single primary type:
VectorReader: A minimal stream for reading from an existing vector by reference.VectorReaderThe VectorReader structure allows reading data from a Vec<u8> starting from a specified position. It supports deserialization and provides methods to query the current read position and the remaining size.
use bitcoin_vectorstream::VectorReader;
use std::sync::Arc;
let data: Vec<u8> = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
let data_arc = Arc::new(data);
let mut reader = VectorReader::new(0, 0, &data_arc, 0);
let mut buffer = [0u8; 5];
reader.read(buffer.as_mut_ptr(), buffer.len());
assert_eq!(&buffer, &[1, 2, 3, 4, 5]);
Minimal stream for reading from an existing Vec
Supports deserialization.
Methods to query the serialization type and version.
Methods to query the current read position and the remaining size.
This project is licensed under the MIT License.