File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -983,6 +983,32 @@ impl Display for MultiTemplate {
983
983
}
984
984
}
985
985
986
+ /// Hash implementation based only on the template string content.
987
+ ///
988
+ /// This implementation ignores interior mutability in parsed operations and
989
+ /// caches, making it safe to use MultiTemplate as a key in hash collections.
990
+ /// Two templates with the same string content will always hash equally.
991
+ impl Hash for MultiTemplate {
992
+ fn hash < H : Hasher > ( & self , state : & mut H ) {
993
+ self . raw . hash ( state) ;
994
+ }
995
+ }
996
+
997
+ /// Equality implementation based only on the template string content.
998
+ ///
999
+ /// Two templates are considered equal if they have the same raw template string,
1000
+ /// regardless of their internal state or cached operations.
1001
+ impl PartialEq for MultiTemplate {
1002
+ fn eq ( & self , other : & Self ) -> bool {
1003
+ self . raw == other. raw
1004
+ }
1005
+ }
1006
+
1007
+ /// Equivalence relation implementation.
1008
+ ///
1009
+ /// Required for use as keys in hash collections. Based on template string equality.
1010
+ impl Eq for MultiTemplate { }
1011
+
986
1012
/* ---------- backward compatibility alias --------------------------------- */
987
1013
988
1014
/// Type alias for backward compatibility.
You can’t perform that action at this time.
0 commit comments