Opens a Parcode file from an in-memory buffer. This is the primary entry point for tests and architectures without direct file access. The `ParcodeFile` takes ownership of the data (wrapped in Arc).
(data: impl Into<Arc<Vec<u8>>>)
| 646 | /// This is the primary entry point for tests and architectures without direct file access. |
| 647 | /// The `ParcodeFile` takes ownership of the data (wrapped in Arc). |
| 648 | pub fn from_bytes(data: impl Into<Arc<Vec<u8>>>) -> Result<Self> { |
| 649 | let data_arc = data.into(); |
| 650 | let size = data_arc.len() as u64; |
| 651 | Self::init(DataSource::Memory(data_arc), size) |
| 652 | } |
| 653 | |
| 654 | fn init(source: DataSource, file_size: u64) -> Result<Self> { |
| 655 | if file_size < GLOBAL_HEADER_SIZE as u64 { |