#byte-stream #chunk #writable #layer #overlay

memoverlay

Puts a writable layer of bytes over some byte stream

4 releases

0.1.3 Apr 12, 2024
0.1.2 Jan 2, 2023
0.1.1 Jan 2, 2023
0.1.0 Jan 2, 2023

#3 in #writable

Download history 39/week @ 2024-07-22 138/week @ 2024-07-29 20/week @ 2024-08-05 90/week @ 2024-08-12 93/week @ 2024-08-19 134/week @ 2024-08-26 38/week @ 2024-09-02 86/week @ 2024-09-09 97/week @ 2024-09-16 67/week @ 2024-09-23 14/week @ 2024-09-30 21/week @ 2024-10-07 30/week @ 2024-10-14 44/week @ 2024-10-21 29/week @ 2024-10-28 15/week @ 2024-11-04

119 downloads per month
Used in 4 crates (via nt_hive2)

GPL-3.0 license

25KB
520 lines

memoverlay

Puts a writable layer of bytes over some byte stream

memoverlay

+-----------------+------------+-----------------+-------+----------------------+-------+-----------------+
|    chunk 0      |  chunk 1   |    chunk 2      |   3   |       chunk 4        |   5   |     chunk 6     |
+-----------------+------------+-----------------+-------+----------------------+-------+-----------------+

                               +-----------------+       +----------------------+
                               +-----------------+       +----------------------+
                  +-------------------+                           +---------------------+
                  +-------------------+                           +---------------------+
+---------------------------------------------------------------------------------------------------------+
+---------------------------------------------------------------------------------------------------------+

Usage example

use std::io::{Cursor, Read, Seek, SeekFrom};
use memoverlay::MemOverlay;
use memoverlay::overlay;

let message1 = "hello, world!";
let mut overlay = overlay!(message1.as_bytes());
overlay.add_bytes_at(7, "peter".as_bytes()).unwrap();

let mut message2 = String::new();
let _ = overlay.read_to_string(&mut message2).unwrap();

assert_eq!(message2, "hello, peter!");

License: GPL-3.0

Dependencies

~255–710KB
~17K SLoC