Bug 1777320 [wpt PR 34649] - Update CSS toggles parsing/computation code to spec...
[gecko.git] / xpcom / string / nsTStringHasher.h
blob7b3f42ba5883c21c27df477df997cbcb8e6e0ee8
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsTStringHasher_h___
8 #define nsTStringHasher_h___
10 #include "mozilla/HashTable.h" // mozilla::{DefaultHasher, HashNumber, HashString}
12 namespace mozilla {
14 template <typename T>
15 struct DefaultHasher<nsTString<T>> {
16 using Key = nsTString<T>;
17 using Lookup = nsTString<T>;
19 static mozilla::HashNumber hash(const Lookup& aLookup) {
20 return mozilla::HashString(aLookup.get());
23 static bool match(const Key& aKey, const Lookup& aLookup) {
24 return aKey.Equals(aLookup);
28 } // namespace mozilla
30 #endif // !defined(nsTStringHasher_h___)