aboutsummaryrefslogtreecommitdiff
path: root/src/transform.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-22 15:57:17 +0100
committerMartin Fischer <martin@push-f.com>2021-11-22 15:57:17 +0100
commit346113bbebddbd199b61249957c7569514071e89 (patch)
tree82a1978a60faf93a00b5cc9ed4aa4f182b3d037f /src/transform.rs
parenta0ec23e259359bbbd115d6159193a361c8ce24df (diff)
support other collections via #[collection(...)]
Diffstat (limited to 'src/transform.rs')
-rw-r--r--src/transform.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/transform.rs b/src/transform.rs
index 05866b6..11a98c2 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -17,6 +17,7 @@ use crate::{
#[derive(Default)]
pub struct TypeConverter<'a> {
pub assoc_type_conversions: HashMap<Ident, DestType<'a>>,
+ pub collections: HashMap<Ident, usize>,
}
#[derive(Debug)]
@@ -39,6 +40,10 @@ impl TypeConverter<'_> {
/// ... etc. A return type of None means the type isn't recognized.
#[rustfmt::skip]
fn get_collection_type_count(&self, ident: &Ident) -> Option<usize> {
+ if let Some(count) = self.collections.get(ident) {
+ return Some(*count);
+ }
+
// when adding a type here don't forget to document it in the README
if ident == "Vec" { return Some(1); }
if ident == "VecDeque" { return Some(1); }