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
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
Source§impl Ord for BreakableString
impl Ord for BreakableString
Source§fn cmp(&self, other: &BreakableString) -> Ordering
fn cmp(&self, other: &BreakableString) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for BreakableString
impl PartialEq for BreakableString
Source§impl PartialOrd for BreakableString
impl PartialOrd for BreakableString
impl Eq for BreakableString
impl StructuralPartialEq for BreakableString
Auto Trait Implementations§
impl Freeze for BreakableString
impl RefUnwindSafe for BreakableString
impl Send for BreakableString
impl Sync for BreakableString
impl Unpin for BreakableString
impl UnwindSafe for BreakableString
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,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)