pub struct StreamingParser { /* private fields */ }Expand description
Streaming parser for memory-efficient SAMM model processing
Implementations§
Source§impl StreamingParser
impl StreamingParser
Sourcepub fn with_chunk_size(self, size: usize) -> Self
pub fn with_chunk_size(self, size: usize) -> Self
Set the chunk size for reading (in bytes)
Smaller chunks use less memory but may be slower. Larger chunks are faster but use more memory.
Default: 64KB
Sourcepub fn with_max_buffer_size(self, size: usize) -> Self
pub fn with_max_buffer_size(self, size: usize) -> Self
Set the maximum buffer size (in bytes)
When the buffer grows beyond this size, the parser will attempt to flush and parse accumulated data.
Default: 16MB
Sourcepub fn with_base_uri(self, base_uri: impl Into<String>) -> Self
pub fn with_base_uri(self, base_uri: impl Into<String>) -> Self
Set the base URI for resolving relative references
Sourcepub async fn parse_file_streaming<P: AsRef<Path>>(
&mut self,
path: P,
) -> Result<impl Stream<Item = Result<Aspect>>>
pub async fn parse_file_streaming<P: AsRef<Path>>( &mut self, path: P, ) -> Result<impl Stream<Item = Result<Aspect>>>
Parse a file using streaming for memory efficiency
This method reads the file in chunks and emits parsed Aspect models as they become available. This is much more memory-efficient than loading the entire file at once.
§Arguments
path- Path to the Turtle file
§Returns
A stream of Result<Aspect, SammError> that emits aspects as they’re parsed
Sourcepub fn parse_reader_streaming<R>(
&mut self,
reader: R,
base_uri: impl Into<String>,
) -> impl Stream<Item = Result<Aspect>>
pub fn parse_reader_streaming<R>( &mut self, reader: R, base_uri: impl Into<String>, ) -> impl Stream<Item = Result<Aspect>>
Parse from an async reader using streaming
This allows streaming from any async source (file, network, etc.)
Sourcepub fn parse_string_streaming(
&self,
content: String,
base_uri: impl Into<String>,
) -> impl Stream<Item = Result<Aspect>>
pub fn parse_string_streaming( &self, content: String, base_uri: impl Into<String>, ) -> impl Stream<Item = Result<Aspect>>
Parse a string using line-by-line streaming
This is useful for processing large in-memory strings without creating multiple copies.
Sourcepub fn config_summary(&self) -> String
pub fn config_summary(&self) -> String
Get current configuration as a summary string
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamingParser
impl RefUnwindSafe for StreamingParser
impl Send for StreamingParser
impl Sync for StreamingParser
impl Unpin for StreamingParser
impl UnsafeUnpin for StreamingParser
impl UnwindSafe for StreamingParser
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.