#[non_exhaustive]pub struct PlannedHeredoc {
pub index: usize,
pub delimiter: String,
pub literal: bool,
pub strip_tabs: bool,
pub body: PlannedValue,
pub body_offset: usize,
pub free_variables: Vec<String>,
}Expand description
One heredoc a PlannedCommand reads on stdin — the body a command is
fed, published as data.
Agents hand whole programs to interpreters this way (python3 <<'PY',
sqlite3 <<SQL), and the shell framing is the part that has to come off
before anything can look at the program. It comes off here: the command
name is on the PlannedCommand, the language hint is
delimiter, and the program is body
with no quoting or escaping applied.
literal decides what the body is worth. A quoted
delimiter (<<'PY') means the body reaches the command exactly as
published; an unquoted one means the shell expands ${…} and $(…)
first, so the published text is what was asked for and not what runs.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.index: usizeThe heredoc’s position among every heredoc in its statement, counted
in source order across every command the statement contains. This is
the heredoc half of a FragmentAddr.
delimiter: StringThe delimiter word as written, quotes removed: PY for both <<PY
and <<'PY'. Authors often pick it for the language they are about to
write, but roughly half the time it says nothing — a bare EOF
outnumbers every self-describing word combined in real agent traffic.
A weak hint worth keeping, never a classification.
literal: boolWhether the delimiter was quoted (<<'PY', <<"PY"). True means no
expansion runs and body is exactly what the command
reads.
strip_tabs: boolWhether the <<- form was used. True means leading tabs come off each
body line before the command sees it; the published body keeps them.
body: PlannedValueThe body as written, verbatim: no tab stripping, no expansion, no quoting, no kernel-internal rewriting. A generated program arrives whole and unescaped, ready to hand to whatever reads that language.
body_offset: usizeByte offset of the body’s first character in the source that was planned, for a caller attributing a finding back to a location.
free_variables: Vec<String>Session variables this body reads — sorted, deduplicated root names,
and always empty when literal is true. These are
the values that plug into the body, and the ones an expansion needs
supplied.
Implementations§
Source§impl PlannedHeredoc
impl PlannedHeredoc
Sourcepub fn new(
index: usize,
delimiter: impl Into<String>,
literal: bool,
strip_tabs: bool,
body: PlannedValue,
body_offset: usize,
) -> PlannedHeredoc
pub fn new( index: usize, delimiter: impl Into<String>, literal: bool, strip_tabs: bool, body: PlannedValue, body_offset: usize, ) -> PlannedHeredoc
Assemble one planned heredoc. The only constructor for this
#[non_exhaustive] type.
Sourcepub fn with_free_variables(self, free: Vec<String>) -> PlannedHeredoc
pub fn with_free_variables(self, free: Vec<String>) -> PlannedHeredoc
Attach the body’s variable analysis (sorted, deduplicated).
Trait Implementations§
Source§impl Clone for PlannedHeredoc
impl Clone for PlannedHeredoc
Source§fn clone(&self) -> PlannedHeredoc
fn clone(&self) -> PlannedHeredoc
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PlannedHeredoc
impl Debug for PlannedHeredoc
Source§impl<'de> Deserialize<'de> for PlannedHeredoc
impl<'de> Deserialize<'de> for PlannedHeredoc
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PlannedHeredoc, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PlannedHeredoc, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for PlannedHeredoc
Source§impl PartialEq for PlannedHeredoc
impl PartialEq for PlannedHeredoc
Source§impl Serialize for PlannedHeredoc
impl Serialize for PlannedHeredoc
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for PlannedHeredoc
Auto Trait Implementations§
impl Freeze for PlannedHeredoc
impl RefUnwindSafe for PlannedHeredoc
impl Send for PlannedHeredoc
impl Sync for PlannedHeredoc
impl Unpin for PlannedHeredoc
impl UnsafeUnpin for PlannedHeredoc
impl UnwindSafe for PlannedHeredoc
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
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.