pub struct BufferManager { /* private fields */ }Expand description
Buffer manager for RDF parsing operations
This manages a pool of reusable buffers to minimize allocations during parsing. Particularly useful for:
- Temporary string buffers during tokenization
- Blank node ID generation
- IRI resolution and prefix expansion
- Literal value accumulation
§Example
use oxirs_ttl::toolkit::BufferManager;
let mut manager = BufferManager::new();
// Acquire a buffer for temporary string operations
let mut buffer = manager.acquire_string_buffer();
buffer.push_str("temporary content");
// Use the buffer...
let content = buffer.clone();
// Release it back to the pool when done
manager.release_string_buffer(buffer);Implementations§
Source§impl BufferManager
impl BufferManager
Sourcepub fn with_capacity(max_pooled_buffers: usize) -> Self
pub fn with_capacity(max_pooled_buffers: usize) -> Self
Create a new buffer manager with specified pool capacity
Sourcepub fn acquire_string_buffer(&mut self) -> String
pub fn acquire_string_buffer(&mut self) -> String
Acquire a string buffer from the pool
Returns a cleared buffer from the pool if available, otherwise allocates a new buffer.
Sourcepub fn acquire_string_buffer_with_capacity(&mut self, capacity: usize) -> String
pub fn acquire_string_buffer_with_capacity(&mut self, capacity: usize) -> String
Acquire a string buffer with specific capacity
Sourcepub fn release_string_buffer(&mut self, buffer: String)
pub fn release_string_buffer(&mut self, buffer: String)
Release a string buffer back to the pool
The buffer will be cleared and reused for future acquisitions. If the pool is full, the buffer is dropped.
Sourcepub fn generate_blank_node_id(&mut self, counter: usize) -> String
pub fn generate_blank_node_id(&mut self, counter: usize) -> String
Generate a blank node ID efficiently using a pooled buffer
Sourcepub fn expand_prefixed_name(
&mut self,
_prefix: &str,
local: &str,
namespace: &str,
) -> String
pub fn expand_prefixed_name( &mut self, _prefix: &str, local: &str, namespace: &str, ) -> String
Expand a prefixed name to a full IRI using a pooled buffer
Sourcepub fn stats(&self) -> &BufferStats
pub fn stats(&self) -> &BufferStats
Get buffer pool statistics
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrink the buffer pool to fit current usage
Trait Implementations§
Source§impl Debug for BufferManager
impl Debug for BufferManager
Auto Trait Implementations§
impl Freeze for BufferManager
impl RefUnwindSafe for BufferManager
impl Send for BufferManager
impl Sync for BufferManager
impl Unpin for BufferManager
impl UnsafeUnpin for BufferManager
impl UnwindSafe for BufferManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Converts
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>
Converts
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 more