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 mod export;
27
28pub(crate) type HashMap<K, V> = indexmap::IndexMap<K, V, rustc_hash::FxBuildHasher>;
34pub(crate) type HashSet<T> = indexmap::IndexSet<T, rustc_hash::FxBuildHasher>;
35
36use std::{hash::Hash, ops::Deref};
37
38#[cfg_attr(
40 feature = "serde",
41 derive(serde::Serialize, serde::Deserialize),
42 serde(transparent),
43 serde(bound = "
44 BidderId: Hash + Eq + serde::Serialize + serde::de::DeserializeOwned,
45 PortfolioId: Clone + Hash + Eq + serde::Serialize + serde::de::DeserializeOwned,
46 ProductId: Hash + Eq + Ord + serde::Serialize + serde::de::DeserializeOwned
47 ")
48)]
49pub struct Auction<BidderId, PortfolioId, ProductId>(
50 HashMap<BidderId, Submission<PortfolioId, ProductId>>,
51);
52
53impl<BidderId, PortfolioId, ProductId> Deref for Auction<BidderId, PortfolioId, ProductId> {
54 type Target = HashMap<BidderId, Submission<PortfolioId, ProductId>>;
55
56 fn deref(&self) -> &Self::Target {
57 &self.0
58 }
59}
60
61impl<BidderId: Hash + Eq, PortfolioId, ProductId>
62 FromIterator<(BidderId, Submission<PortfolioId, ProductId>)>
63 for Auction<BidderId, PortfolioId, ProductId>
64{
65 fn from_iter<T: IntoIterator<Item = (BidderId, Submission<PortfolioId, ProductId>)>>(
66 iter: T,
67 ) -> Self {
68 Self(HashMap::<BidderId, Submission<PortfolioId, ProductId>>::from_iter(iter))
69 }
70}