Skip to content

Commit

Permalink
Make Select accessors public (bazelbuild#2528)
Browse files Browse the repository at this point in the history
  • Loading branch information
qtica authored and scramm committed Apr 1, 2024
1 parent 7b22806 commit 0f4b8b1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions crate_universe/src/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit 0f4b8b1

Please sign in to comment.