Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["codegen", "examples", "performance_measurement", "performance_measur

[package]
name = "worktable"
version = "0.8.18"
version = "0.8.19"
edition = "2024"
authors = ["Handy-caT"]
license = "MIT"
Expand All @@ -16,7 +16,7 @@ perf_measurements = ["dep:performance_measurement", "dep:performance_measurement
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
worktable_codegen = { path = "codegen", version = "=0.8.18" }
worktable_codegen = { path = "codegen", version = "=0.8.19" }

eyre = "0.6.12"
derive_more = { version = "2.0.1", features = ["from", "error", "display", "into"] }
Expand All @@ -27,9 +27,9 @@ lockfree = { version = "0.5.1" }
fastrand = "2.3.0"
futures = "0.3.30"
uuid = { version = "1.10.0", features = ["v4", "v7"] }
data_bucket = "=0.3.9"
data_bucket = "=0.3.10"
# data_bucket = { git = "https://github.com/pathscale/DataBucket", branch = "page_cdc_correction", version = "0.2.7" }
# data_bucket = { path = "../DataBucket", version = "0.3.8" }
# data_bucket = { path = "../DataBucket", version = "0.3.9" }
performance_measurement_codegen = { path = "performance_measurement/codegen", version = "0.1.0", optional = true }
performance_measurement = { path = "performance_measurement", version = "0.1.0", optional = true }
indexset = { version = "=0.14.0", features = ["concurrent", "cdc", "multimap"] }
Expand Down
2 changes: 1 addition & 1 deletion codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "worktable_codegen"
version = "0.8.18"
version = "0.8.19"
edition = "2024"
license = "MIT"
description = "WorkTable codegeneration crate"
Expand Down
42 changes: 25 additions & 17 deletions codegen/src/persist_index/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,31 @@ impl Generator {
.clone()
.expect("index fields should always be named fields"),
);
let index_type = field.ty.to_token_stream().to_string();
let mut split = index_type.split("<");
// skip `IndexMap` ident.
split.next();
let substr = split
.next()
.expect("index type should always contain key generic")
.to_string();
types.push(
substr
.split(",")
.next()
.expect("index type should always contain key and value generics")
.to_string()
.parse()
.expect("should be valid because parsed from declaration"),
);

let syn::Type::Path(type_path) = &field.ty else {
unreachable!()
};

let last_segment = type_path
.path
.segments
.last()
.expect("Index type should have at least one segment");

let syn::PathArguments::AngleBracketed(arguments) = &last_segment.arguments else {
unreachable!("IndexMap always have angle brackets arguments which are generic")
};

let first_arg = arguments
.args
.first()
.expect("Index type should have at least one type argument");

let syn::GenericArgument::Type(ty) = first_arg else {
unreachable!("Index type should have at least one type argument")
};

types.push(ty.to_token_stream());
}
let map = fields.into_iter().zip(types).collect::<HashMap<_, _>>();

Expand Down
Loading
Loading