Skip to main content

substrate_data/schema/reader/
keys.rs

1//! The source-only keys every object may have.
2
3/// A note for whoever edits the file — every object may have one.
4pub const COMMENT_KEY: &str = "comment";
5/// What a source-only key starts with: `$…` (a note on an entry: `$<key>`), `_…`.
6pub const META_PREFIX: char = '$';
7/// What a private source-only key starts with: `_…`.
8pub const PRIVATE_PREFIX: char = '_';
9
10/// Source-only keys every object may have: `$…`, `_…`, `comment`.
11#[must_use]
12pub fn is_metadata_key(key: &str) -> bool {
13    key.starts_with(META_PREFIX) || key.starts_with(PRIVATE_PREFIX) || key == COMMENT_KEY
14}