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
sourceimpl 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
sourceimpl<'de> Deserialize<'de> for Attribute
impl<'de> Deserialize<'de> for Attribute
sourcefn 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
sourceimpl<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>,
sourceimpl<'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.
sourcefn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Convert this value into a deserializer.
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<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,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.