pub struct HeredocAssembler { /* private fields */ }Expand description
Assembles a heredoc body part-by-part, applying POSIX <<- leading-tab
stripping to the source rather than to the materialized result.
Leading tabs that were literal in the heredoc source are stripped; a tab
that arrives via an interpolation ($var value, $(cmd) output) at line
start is preserved, because POSIX strips tabs from source lines before
parameter expansion (bash agrees). Callers feed literal segments through
push_literal and interpolated values through
push_interpolated. With strip_tabs == false
this is a plain concatenation.
This replaces materialize-then-strip_leading_tabs, which ate tabs that
came from a variable’s value.
Implementations§
Source§impl HeredocAssembler
impl HeredocAssembler
pub fn new(strip_tabs: bool) -> Self
Sourcepub fn push_literal(&mut self, literal: &str)
pub fn push_literal(&mut self, literal: &str)
Append a literal source segment, stripping leading tabs at line starts
when in <<- mode.
Sourcepub fn push_interpolated(&mut self, value: &str)
pub fn push_interpolated(&mut self, value: &str)
Append an interpolated value verbatim. The interpolation terminates the leading-tab run for the current source line — even when it expands to empty — so a following literal tab on the same source line is mid-line and kept.
pub fn into_string(self) -> String
Auto Trait Implementations§
impl Freeze for HeredocAssembler
impl RefUnwindSafe for HeredocAssembler
impl Send for HeredocAssembler
impl Sync for HeredocAssembler
impl Unpin for HeredocAssembler
impl UnsafeUnpin for HeredocAssembler
impl UnwindSafe for HeredocAssembler
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> Pointable for T
impl<T> Pointable for T
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.