Skip to content

Commit

Permalink
Merge pull request #19 from k9withabone/validation
Browse files Browse the repository at this point in the history
Basic Validation
  • Loading branch information
k9withabone authored Jun 2, 2024
2 parents 619a25d + 2701f3a commit 8393052
Show file tree
Hide file tree
Showing 7 changed files with 451 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ sort_commits = "oldest"

[package]
name = "compose_spec"
version = "0.2.0"
version = "0.2.1-alpha.1"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
11 changes: 11 additions & 0 deletions src/common/short_or_long.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ where
}
}

impl<K, V> ShortOrLong<IndexSet<K>, IndexMap<K, V>> {
/// Returns an [`Iterator`] of items in the list of the [`Short`](Self::Short) syntax or the
/// keys in the map of the [`Long`](Self::Long) syntax.
pub(crate) fn keys(&self) -> impl Iterator<Item = &K> {
match self {
Self::Short(set) => ShortOrLong::Short(set.iter()),
Self::Long(map) => ShortOrLong::Long(map.keys()),
}
}
}

/// Trait for types that represent a long syntax which could also be represented in a short syntax.
pub trait AsShort {
/// The short syntax type, returned from [`as_short()`](AsShort::as_short()).
Expand Down
Loading

0 comments on commit 8393052

Please sign in to comment.