pub struct Parser { /* private fields */ }Expand description
Stateful parser that enforces a memory budget during parsing (binary → raw structures).
The parse chain reserves memory before allocations so total heap stays within the limit.
use mlt_core::Parser;
let mut parser = Parser::default();
let layers = parser.parse_layers(bytes).expect("parse");
// Or with a custom limit:
let mut parser = Parser::with_max_size(64 * 1024 * 1024);Implementations§
Source§impl Parser
impl Parser
Sourcepub fn with_max_size(max_bytes: u32) -> Self
pub fn with_max_size(max_bytes: u32) -> Self
Create a parser with a custom memory budget (in bytes).
Sourcepub fn parse_layers<'a>(
&mut self,
input: &'a [u8],
) -> Result<Vec<Layer<'a>>, MltError>
pub fn parse_layers<'a>( &mut self, input: &'a [u8], ) -> Result<Vec<Layer<'a>>, MltError>
Parse a sequence of binary layers, reserving decoded memory against this parser’s budget.
pub fn reserved(&self) -> u32
Trait Implementations§
impl Eq for Parser
impl StructuralPartialEq for Parser
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnsafeUnpin for Parser
impl UnwindSafe for Parser
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