From f69784f1b2fd3ddff356615ae01db61c39da7bc3 Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Wed, 28 Feb 2024 18:13:24 +0000 Subject: Make `Select` accessors public (#2528) --- crate_universe/src/select.rs | 13 +++++++++---- 1 file 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 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 { + /// A list of the configurations which have some configuration-specific value associated. + pub fn configurations(&self) -> BTreeSet { self.selects.keys().cloned().collect() } - pub(crate) fn items(&self) -> Vec<(Option, T::ItemType)> { + /// All values and their associated configurations, if any. + pub fn items(&self) -> Vec<(Option, T::ItemType)> { T::items(self) } - pub(crate) fn values(&self) -> Vec { + /// All values, whether common or configured. + pub fn values(&self) -> Vec { T::values(self) } -- cgit v1.2.3