pub struct BreakableString {
pub span: Span,
pub components: Vec<BreakableStringComponent>,
}
Expand description
A Docker string that may be broken across several lines, separated by line
continuations (\\\n
), and possibly intermixed with comments.
These strings have several potentially valid interpretations. As these line
continuations match those natively supported by bash, a given multiline
RUN
block can be pasted into a bash shell unaltered and with line
continuations included. However, at “runtime” line continuations and
comments (*) are stripped from the string handed to the shell.
To ensure output is correct in all cases, BreakableString
preserves the
user’s original AST, including comments, and implements Docker’s
continuation-stripping behavior in the Display
implementation.
Fields§
§span: Span
§components: Vec<BreakableStringComponent>
Implementations§
Source§impl BreakableString
impl BreakableString
pub fn new(span: impl Into<Span>) -> Self
pub fn add(self, c: impl Into<BreakableStringComponent>) -> Self
pub fn add_string(self, s: impl Into<Span>, c: impl Into<String>) -> Self
pub fn add_comment(self, s: impl Into<Span>, c: impl Into<String>) -> Self
pub fn iter_components(&self) -> impl Iterator<Item = &BreakableStringComponent>
Trait Implementations§
Source§impl Clone for BreakableString
impl Clone for BreakableString
Source§fn clone(&self) -> BreakableString
fn clone(&self) -> BreakableString
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BreakableString
impl Debug for BreakableString
Source§impl Display for BreakableString
Formats this breakable string as it will be interpreted by the underlying
Docker engine, i.e. on a single line with line continuations removed
impl Display for BreakableString
Formats this breakable string as it will be interpreted by the underlying Docker engine, i.e. on a single line with line continuations removed