summaryrefslogtreecommitdiffstats
path: root/vendor/rust-analyzer-salsa/examples/compiler/values.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rust-analyzer-salsa/examples/compiler/values.rs')
-rw-r--r--vendor/rust-analyzer-salsa/examples/compiler/values.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/rust-analyzer-salsa/examples/compiler/values.rs b/vendor/rust-analyzer-salsa/examples/compiler/values.rs
new file mode 100644
index 000000000..2649029ea
--- /dev/null
+++ b/vendor/rust-analyzer-salsa/examples/compiler/values.rs
@@ -0,0 +1,35 @@
+#[derive(Clone, Debug, Hash, PartialEq, Eq)]
+pub struct ClassData {
+ pub fields: Vec<Field>,
+}
+
+#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
+pub struct Class(salsa::InternId);
+
+impl salsa::InternKey for Class {
+ fn from_intern_id(id: salsa::InternId) -> Self {
+ Self(id)
+ }
+
+ fn as_intern_id(&self) -> salsa::InternId {
+ self.0
+ }
+}
+
+#[derive(Clone, Debug, Hash, PartialEq, Eq)]
+pub struct FieldData {
+ pub name: String,
+}
+
+#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
+pub struct Field(salsa::InternId);
+
+impl salsa::InternKey for Field {
+ fn from_intern_id(id: salsa::InternId) -> Self {
+ Self(id)
+ }
+
+ fn as_intern_id(&self) -> salsa::InternId {
+ self.0
+ }
+}