pub struct Address(/* private fields */);Expand description
Terraform-style resource address.
Examples: aws_db_instance.x, module.pacer_db.aws_db_instance.this,
module.foo.module.bar.aws_iam_role.r[0].
§Validation
Each candidate must:
- be non-empty;
- be at most
ADDRESS_MAX_BYTESbytes; - contain only characters in the allowlist
A-Z,a-z,0-9,_,.,/,-,[,],"; - have balanced
[]and".
Use Address::new or TryFrom<&str> / FromStr to construct.
Implementations§
Source§impl Address
impl Address
Sourcepub fn new(s: impl AsRef<str>) -> Result<Self, ValidationError>
pub fn new(s: impl AsRef<str>) -> Result<Self, ValidationError>
Construct an Address, running every validation rule.
§Errors
Returns a ValidationError variant naming the rule that failed.
Sourcepub fn module_segments(&self) -> ModuleSegments<'_> ⓘ
pub fn module_segments(&self) -> ModuleSegments<'_> ⓘ
Iterate the module name segments of this address, in order.
Examples:
aws_iam_role.r→ empty.module.pacer_db.aws_db_instance.this→["pacer_db"].module.outer.module.inner.aws_iam_role.r→["outer", "inner"].
Sourcepub fn module_path(&self) -> String
pub fn module_path(&self) -> String
Module-path prefix of this address, dot-joined.
"" for top-level resources, "pacer_db" for one-level, "outer.inner" for nested.
This mirrors the module_path Parquet column shape pinned in
10-data-model.md § 3.
Sourcepub fn resource_part(&self) -> &str
pub fn resource_part(&self) -> &str
The non-module suffix of this address (e.g. "aws_db_instance.this").
Returns "" if the address is malformed (every leading module.X segment
consumed but nothing left). Such input cannot reach this code path because
the constructor rejects it via the charset / balance check.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Address
impl<'de> Deserialize<'de> for Address
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>,
Source§impl Ord for Address
impl Ord for Address
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Address
impl PartialOrd for Address
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnsafeUnpin for Address
impl UnwindSafe for Address
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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.