1#![warn(missing_docs)]
2#![doc = include_str!("../README.md")]
8
9mod impls;
13pub use impls::*;
14
15mod types;
19pub use types::*;
20
21#[cfg(feature = "io")]
23pub mod io;
24
25pub(crate) type HashMap<K, V> = indexmap::IndexMap<K, V, rustc_hash::FxBuildHasher>;
31pub(crate) type HashSet<T> = indexmap::IndexSet<T, rustc_hash::FxBuildHasher>;
32
33use std::{hash::Hash, ops::Deref};
34
35#[cfg_attr(
37 feature = "serde",
38 derive(serde::Serialize, serde::Deserialize),
39 serde(transparent),
40 serde(bound = "
41 BidderId: Hash + Eq + serde::Serialize + serde::de::DeserializeOwned,
42 PortfolioId: Clone + Hash + Eq + serde::Serialize + serde::de::DeserializeOwned,
43 ProductId: Hash + Eq + Ord + serde::Serialize + serde::de::DeserializeOwned
44 ")
45)]
46pub struct Auction<BidderId, PortfolioId, ProductId>(
47 HashMap<BidderId, Submission<PortfolioId, ProductId>>,
48);
49
50impl<BidderId, PortfolioId, ProductId> Deref for Auction<BidderId, PortfolioId, ProductId> {
51 type Target = HashMap<BidderId, Submission<PortfolioId, ProductId>>;
52
53 fn deref(&self) -> &Self::Target {
54 &self.0
55 }
56}
57
58impl<BidderId: Hash + Eq, PortfolioId, ProductId>
59 FromIterator<(BidderId, Submission<PortfolioId, ProductId>)>
60 for Auction<BidderId, PortfolioId, ProductId>
61{
62 fn from_iter<T: IntoIterator<Item = (BidderId, Submission<PortfolioId, ProductId>)>>(
63 iter: T,
64 ) -> Self {
65 Self(HashMap::<BidderId, Submission<PortfolioId, ProductId>>::from_iter(iter))
66 }
67}