pub struct FuncArgs { /* private fields */ }
Expand description
Type representing the arguments of a function call.
In the HCL grammar, function arguments are delimited by (
and )
.
Implementations§
Source§impl FuncArgs
impl FuncArgs
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Constructs new, empty FuncArgs
with at least the specified capacity.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of function arguments, also referred to as its ‘length’.
Sourcepub fn get(&self, index: usize) -> Option<&Expression>
pub fn get(&self, index: usize) -> Option<&Expression>
Returns a reference to the argument at the given index, or None
if the index is out of
bounds.
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut Expression>
pub fn get_mut(&mut self, index: usize) -> Option<&mut Expression>
Returns a mutable reference to the argument at the given index, or None
if the index is
out of bounds.
Sourcepub fn insert(&mut self, index: usize, arg: impl Into<Expression>)
pub fn insert(&mut self, index: usize, arg: impl Into<Expression>)
Inserts an argument at position index
, shifting all arguments after it to the right.
§Panics
Panics if index > len
.
Sourcepub fn pop(&mut self) -> Option<Expression>
pub fn pop(&mut self) -> Option<Expression>
Removes the last argument and returns it, or None
if it is empty.
Sourcepub fn push(&mut self, arg: impl Into<Expression>)
pub fn push(&mut self, arg: impl Into<Expression>)
Sourcepub fn remove(&mut self, index: usize) -> Expression
pub fn remove(&mut self, index: usize) -> Expression
Removes and returns the argument at position index
, shifting all arguments after it to
the left.
Like Vec::remove
, the argument is removed by shifting all of the arguments that follow
it, preserving their relative order. This perturbs the index of all of those elements!
§Panics
Panics if index
is out of bounds.
Sourcepub fn iter(&self) -> Iter<'_>
pub fn iter(&self) -> Iter<'_>
An iterator visiting all values in insertion order. The iterator element type is &'a Expression
.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_>
pub fn iter_mut(&mut self) -> IterMut<'_>
An iterator visiting all values in insertion order, with mutable references to the values.
The iterator element type is &'a mut Expression
.
Sourcepub fn expand_final(&self) -> bool
pub fn expand_final(&self) -> bool
Returns true
if the final argument is a ...
list expansion.
Sourcepub fn set_expand_final(&mut self, yes: bool)
pub fn set_expand_final(&mut self, yes: bool)
Set whether the final argument should be a ...
list expansion.
Sourcepub fn trailing(&self) -> &RawString
pub fn trailing(&self) -> &RawString
Return a reference to raw trailing decor before the function argument’s closing )
.
Sourcepub fn set_trailing(&mut self, trailing: impl Into<RawString>)
pub fn set_trailing(&mut self, trailing: impl Into<RawString>)
Set the raw trailing decor before the function argument’s closing )
.
Sourcepub fn trailing_comma(&self) -> bool
pub fn trailing_comma(&self) -> bool
Returns true
if the function arguments use a trailing comma.
Sourcepub fn set_trailing_comma(&mut self, yes: bool)
pub fn set_trailing_comma(&mut self, yes: bool)
Set whether the function arguments will use a trailing comma.
Trait Implementations§
Source§impl<T> Extend<T> for FuncArgswhere
T: Into<Expression>,
impl<T> Extend<T> for FuncArgswhere
T: Into<Expression>,
Source§fn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, iterable: I)where
I: IntoIterator<Item = T>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)