pub struct Attribute {
pub key: Identifier,
pub expr: Expression,
}
Expand description
Represents an HCL attribute which consists of an attribute key and a value expression.
In HCL syntax this is represented as:
key = value
Use Attribute::new
to construct an Attribute
from a value that is convertible to this
crate’s Expression
type.
Fields§
§key: Identifier
The HCL attribute’s key.
expr: Expression
The value expression of the HCL attribute.
Implementations§
source§impl Attribute
impl Attribute
sourcepub fn new<K, V>(key: K, expr: V) -> Attributewhere
K: Into<Identifier>,
V: Into<Expression>,
pub fn new<K, V>(key: K, expr: V) -> Attributewhere K: Into<Identifier>, V: Into<Expression>,
Creates a new Attribute
from an attribute key that is convertible into a String
and an
attribute value that is convertible into an Expression
.
sourcepub fn expr(&self) -> &Expression
pub fn expr(&self) -> &Expression
Returns a reference to the attribute value expression.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Attribute
impl<'de> Deserialize<'de> for Attribute
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Format for Attribute
impl Format for Attribute
source§fn format<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<()>where
W: Write,
fn format<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<()>where W: Write,
Formats a HCL structure using a formatter and writes the result to the provided writer. Read more
source§impl<K, V> From<(K, V)> for Attributewhere
K: Into<Identifier>,
V: Into<Expression>,
impl<K, V> From<(K, V)> for Attributewhere K: Into<Identifier>, V: Into<Expression>,
source§impl<'de> IntoDeserializer<'de, Error> for Attribute
impl<'de> IntoDeserializer<'de, Error> for Attribute
§type Deserializer = MapAccessDeserializer<AttributeAccess>
type Deserializer = MapAccessDeserializer<AttributeAccess>
The type of the deserializer being converted into.
source§fn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Convert this value into a deserializer.
source§impl PartialEq<Attribute> for Attribute
impl PartialEq<Attribute> for Attribute
impl Eq for Attribute
impl StructuralEq for Attribute
impl StructuralPartialEq for Attribute
Auto Trait Implementations§
impl RefUnwindSafe for Attribute
impl Send for Attribute
impl Sync for Attribute
impl Unpin for Attribute
impl UnwindSafe for Attribute
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
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.