pub struct Reader {
pub schemas: Vec<Schema>,
pub unions: Vec<Union>,
/* private fields */
}Expand description
Binary format reader with mmap support for zero-copy access
Fields§
§schemas: Vec<Schema>§unions: Vec<Union>Implementations§
Source§impl Reader
impl Reader
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open a binary TeaLeaf file (reads into memory)
Sourcepub fn open_mmap<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open_mmap<P: AsRef<Path>>(path: P) -> Result<Self>
Open a binary TeaLeaf file with memory mapping (zero-copy)
This is faster for large files as the OS handles paging. The file must not be modified while the reader is open.
§Safety
The underlying file must not be modified while the reader exists.
Sourcepub fn from_bytes(data: Vec<u8>) -> Result<Self>
pub fn from_bytes(data: Vec<u8>) -> Result<Self>
Create reader from owned bytes
Sourcepub fn get_string(&self, idx: usize) -> Result<String>
pub fn get_string(&self, idx: usize) -> Result<String>
Get a string by index
Sourcepub fn is_root_array(&self) -> bool
pub fn is_root_array(&self) -> bool
Check if the source JSON was a root-level array
When true, the “root” key contains the array and to_json should
output it directly without wrapping in an object.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear the decompression cache to free memory
Auto Trait Implementations§
impl !Freeze for Reader
impl !RefUnwindSafe for Reader
impl Send for Reader
impl !Sync for Reader
impl Unpin for Reader
impl UnwindSafe for Reader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more