/// Read a database from a single stream, in packed format.
///
/// This reads the entire database into memory. It is mostly useful for toy use
/// cases.
///
/// The compile-time page size must match the page size of the file. In practice
/// only page size 4096 should be used; the other page sizes exist only for use
/// in tests and fuzzing, to test deeper trees, and uncover edge cases.
/// Nonetheless, the page size is stored in the file, so we can confirm that it
/// matches.
Read a database from a single stream, in packed format.
This reads the entire database into memory. It is mostly useful for toy use
cases.

The compile-time page size must match the page size of the file. In practice
only page size 4096 should be used; the other page sizes exist only for use
in tests and fuzzing, to test deeper trees, and uncover edge cases.
Nonetheless, the page size is stored in the file, so we can confirm that it
matches.
Read a database from a single stream in packed format . This reads the entire database into memory . It is mostly useful for toy use cases . The compile - time page size must match the page size of the file . In practice only page size 4096 should be used ; the other page sizes exist only for use in tests and fuzzing to test deeper trees and uncover edge cases . Nonetheless the page size is stored in the file so we can confirm that it matches .
pub fn read_packed<Size: store::PageSize>(
    mut input: &mut dyn io::Read
) -> io::Result<Database<MemoryStore<Size>, MemoryHeap>> {
    let header = read_packed_header(input)?;
    assert_eq!(header.page_size_in_bytes as usize, Size::SIZE);
    // Then we expect to find zero padding, up to the next multiple of the page
    // size.
    let mut buffer = vec![0_u8; Size::SIZE - 80];
    input.read_exact(&mut buffer[..])?;
    assert!(buffer.iter().all(|byte| *byte == 0));
    let store_buffer = read_exact(&mut input, header.store_size_in_bytes as usize)?;
    let heap_buffer = read_exact(&mut input, header.heap_size_in_bytes as usize)?;
    let store: MemoryStore<Size> = MemoryStore::from_vec(store_buffer);
    let heap = MemoryHeap::from_vec(heap_buffer);
    let db = Database::open(store, heap, header.head);
    Ok(db)
}
pub fn read_packed < Size : store :: PageSize > ( mut input : & mut dyn io :: Read ) -> io :: Result < Database < MemoryStore < Size > , MemoryHeap > > { let header = read_packed_header ( input ) ? ; assert_eq ! ( header page_size_in_bytes as usize Size SIZE ) ; // Then we expect to find zero padding, up to the next multiple of the page // size. let mut buffer = vec ! [ 0_u8 Size SIZE 80 ] ; input . read_exact ( & mut buffer [ .. ] ) ? ; assert ! ( buffer iter ( ) all ( byte byte 0 ) ) ; let store_buffer = read_exact ( & mut input , header . store_size_in_bytes as usize ) ? ; let heap_buffer = read_exact ( & mut input , header . heap_size_in_bytes as usize ) ? ; let store : MemoryStore < Size > = MemoryStore :: from_vec ( store_buffer ) ; let heap = MemoryHeap :: from_vec ( heap_buffer ) ; let db = Database :: open ( store , heap , header . head ) ; Ok ( db ) }
Read a database from a single stream, in packed format.
Read a database from a single stream in packed format .
input
&mut dyn io::Read