pub enum Strip {
None,
Start,
End,
Both,
}
Expand description
Controls the whitespace strip behaviour for template interpolations and directives on adjacent string literals.
The strip behaviour is controlled by a ~
immediately following an interpolation (${
) or
directive (%{
) introduction, or preceding the closing }
.
Whitespace is stripped up until (and including) the next line break:
${~ expr}
strips whitespace from an immediately preceding string literal.${expr ~}
strips whitespace from an immediately following string literal.${~ expr ~}
strips whitespace from immediately preceding and following string literals.${expr}
does not strip any whitespace.
The stripping behaviour is equivalent for template directives (%{expr}
).
For more details, check the section about template literals in the HCL syntax specification.
Variants§
None
Don’t strip adjacent spaces.
Start
Strip any adjacent spaces from the immediately preceding string literal, if there is one.
End
Strip any adjacent spaces from the immediately following string literal, if there is one.
Both
Strip any adjacent spaces from the immediately preceding and following string literals, if there are any.
Implementations§
Source§impl Strip
impl Strip
Sourcepub fn strip_start(self) -> bool
pub fn strip_start(self) -> bool
Returns true
if adjacent spaces should be stripped from an immediately preceding string
literal.
§Example
assert!(!Strip::None.strip_start());
assert!(Strip::Start.strip_start());
assert!(!Strip::End.strip_start());
assert!(Strip::Both.strip_start());