1use crate::variable_ref::VariableRef;
2use serde::{Deserialize, Serialize};
3use std::hash::{Hash, Hasher};
45/// A reference to a field of a larger variable, such as a field in a struct. The fields
6/// are the recursive path to the fields inside the (translated) root
7#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
8pub struct FieldRef<VarId, ScopeId> {
9pub root: VariableRef<VarId, ScopeId>,
10pub field: Vec<String>,
11}
1213// Manual implementation because of https://github.com/rust-lang/rust/issues/26925
14impl<VarId, ScopeId> Hash for FieldRef<VarId, ScopeId> {
15fn hash<H: Hasher>(&self, state: &mut H) {
16let FieldRef { root, field } = self;
17 root.hash(state);
18 field.hash(state);
19 }
20}