aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <dwagnerhall@apple.com>2024-02-28 18:13:24 +0000
committerGitHub <noreply@github.com>2024-02-28 18:13:24 +0000
commitf69784f1b2fd3ddff356615ae01db61c39da7bc3 (patch)
tree8c58e51351a96630a727439d5e8eb53d5aab57d9
parent422c3b2ba057afd2fbb0c7ae16064ecd35255870 (diff)
downloadbazelbuild-rules_rust-f69784f1b2fd3ddff356615ae01db61c39da7bc3.tar.gz
Make `Select` accessors public (#2528)
-rw-r--r--crate_universe/src/select.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/crate_universe/src/select.rs b/crate_universe/src/select.rs
index 0e802643..d2662fc0 100644
--- a/crate_universe/src/select.rs
+++ b/crate_universe/src/select.rs
@@ -3,6 +3,7 @@ use std::fmt::Debug;
use serde::{de::DeserializeOwned, Deserialize, Deserializer, Serialize};
+/// A wrapper around values where some values may be conditionally included (e.g. only on a certain platform), and others are unconditional.
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct Select<T>
where
@@ -78,19 +79,23 @@ where
}
}
- pub(crate) fn is_empty(&self) -> bool {
+ /// Whether there zero values in this collection, common or configuration-specific.
+ pub fn is_empty(&self) -> bool {
T::is_empty(self)
}
- pub(crate) fn configurations(&self) -> BTreeSet<String> {
+ /// A list of the configurations which have some configuration-specific value associated.
+ pub fn configurations(&self) -> BTreeSet<String> {
self.selects.keys().cloned().collect()
}
- pub(crate) fn items(&self) -> Vec<(Option<String>, T::ItemType)> {
+ /// All values and their associated configurations, if any.
+ pub fn items(&self) -> Vec<(Option<String>, T::ItemType)> {
T::items(self)
}
- pub(crate) fn values(&self) -> Vec<T::ItemType> {
+ /// All values, whether common or configured.
+ pub fn values(&self) -> Vec<T::ItemType> {
T::values(self)
}