pub struct MemoryManager<T: Token> { /* private fields */ }Expand description
Utility struct for managing memory allocation and string interning. In particular, it
provides a CSHandler implementation for interning control
sequence names (if applicable).
Implementations§
Source§impl<T: Token> MemoryManager<T>
impl<T: Token> MemoryManager<T>
Sourcepub fn get_bytes(&mut self) -> Vec<u8> ⓘ
pub fn get_bytes(&mut self) -> Vec<u8> ⓘ
Provides an empty Vec<u8> that can be returned using return_bytes, avoiding
the need to allocate a new Vec<u8> every time.
Sourcepub fn return_bytes(&mut self, b: Vec<u8>)
pub fn return_bytes(&mut self, b: Vec<u8>)
Returns a Vec<u8> to the memory manager, which clears it and keeps it in memory for reuse.
Sourcepub fn get_string(&mut self) -> String
pub fn get_string(&mut self) -> String
Provides an empty String that can be returned using return_string, avoiding
the need to allocate a new String every time.
Sourcepub fn return_string(&mut self, s: String)
pub fn return_string(&mut self, s: String)
Returns a String to the memory manager, which clears it and keeps it in memory for reuse.
Sourcepub fn get_token_vec(&mut self) -> Vec<T>
pub fn get_token_vec(&mut self) -> Vec<T>
Provides an empty Vec<T> that can be returned using return_token_vec, avoiding
the need to allocate a new Vec<T> every time.
Sourcepub fn return_token_vec(&mut self, v: Vec<T>)
pub fn return_token_vec(&mut self, v: Vec<T>)
Returns a Vec<T> to the memory manager, which clears it and keeps it in memory for reuse.
Sourcepub fn new_with_cs_interner(
cs_interner: <T::CS as CSName<T::Char>>::Handler,
) -> Self
pub fn new_with_cs_interner( cs_interner: <T::CS as CSName<T::Char>>::Handler, ) -> Self
Returns a new memory manager with the given control sequence interner.
Sourcepub fn set_cs_interner(
&mut self,
cs_interner: <T::CS as CSName<T::Char>>::Handler,
)
pub fn set_cs_interner( &mut self, cs_interner: <T::CS as CSName<T::Char>>::Handler, )
Sets the control sequence interner.
Sourcepub fn cs_interner_mut(&mut self) -> &mut <T::CS as CSName<T::Char>>::Handler
pub fn cs_interner_mut(&mut self) -> &mut <T::CS as CSName<T::Char>>::Handler
Returns the control sequence interner mutably.
Sourcepub fn cs_interner(&self) -> &<T::CS as CSName<T::Char>>::Handler
pub fn cs_interner(&self) -> &<T::CS as CSName<T::Char>>::Handler
Returns the control sequence interner.
Sourcepub fn empty_list(&self) -> TokenList<T>
pub fn empty_list(&self) -> TokenList<T>
Returns an empty token list.
Trait Implementations§
Source§impl<T: Clone + Token> Clone for MemoryManager<T>
impl<T: Clone + Token> Clone for MemoryManager<T>
Source§fn clone(&self) -> MemoryManager<T>
fn clone(&self) -> MemoryManager<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<T> Freeze for MemoryManager<T>
impl<T> RefUnwindSafe for MemoryManager<T>
impl<T> Send for MemoryManager<T>
impl<T> Sync for MemoryManager<T>
impl<T> Unpin for MemoryManager<T>
impl<T> UnsafeUnpin for MemoryManager<T>
impl<T> UnwindSafe for MemoryManager<T>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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<ET, Err, A> IntoErr<ET, Err> for Awhere
ET: EngineTypes,
Err: From<A>,
impl<ET, Err, A> IntoErr<ET, Err> for Awhere
ET: EngineTypes,
Err: From<A>,
§impl<T> Pointable for T
impl<T> Pointable for T
§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().