Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Validation #19

Merged
merged 6 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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