pub struct StreamingExpand { /* private fields */ }Expand description
Streaming template expansion state machine.
Processes input bytes incrementally, expanding {{ env:KEY }} placeholders.
At most MAX_PLACEHOLDER_SCAN bytes are held in buffer. Plain text streams
flush immediately with zero buffering.
Implementations§
Source§impl StreamingExpand
impl StreamingExpand
Sourcepub fn new(
overrides: &[(String, String)],
env: &HashMap<String, String>,
) -> Self
pub fn new( overrides: &[(String, String)], env: &HashMap<String, String>, ) -> Self
Create with env vars and optional explicit overrides. Overrides take precedence over env vars.
Sourcepub fn with_vars(self, vars: &HashMap<String, Value>) -> Self
pub fn with_vars(self, vars: &HashMap<String, Value>) -> Self
Create with env vars, structured variables, and optional explicit overrides.
Enables key-path evaluation in template tags (e.g., {{ pkg.package.name }}).
Sourcepub fn process_bytes(
&mut self,
input: &[u8],
out: &mut Vec<u8>,
) -> Result<usize>
pub fn process_bytes( &mut self, input: &[u8], out: &mut Vec<u8>, ) -> Result<usize>
Process a chunk of input bytes, writing expanded output to out.
Returns early on empty input to preserve pending boundary state.
Sourcepub fn flush(self, out: &mut Vec<u8>) -> Result<()>
pub fn flush(self, out: &mut Vec<u8>) -> Result<()>
Flush remaining buffer. Incomplete placeholders are treated as literals.
Sourcepub fn expand_string(self, input: &str) -> Result<String>
pub fn expand_string(self, input: &str) -> Result<String>
Process a complete string (convenience for short command arguments).
Auto Trait Implementations§
impl Freeze for StreamingExpand
impl RefUnwindSafe for StreamingExpand
impl Send for StreamingExpand
impl Sync for StreamingExpand
impl Unpin for StreamingExpand
impl UnsafeUnpin for StreamingExpand
impl UnwindSafe for StreamingExpand
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