| 1 | // Copyright 2014 The Servo Project Developers. See the COPYRIGHT |
| 2 | // file at the top-level directory of this distribution. |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 5 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 6 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 7 | // option. This file may not be copied, modified, or distributed |
| 8 | // except according to those terms. |
| 9 | |
| 10 | use craterust-analyzer cargo string_cache 0.9.0 crate/::{Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#, StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#}; |
| 11 | #[cfg(feature = "serde_support")] |
| 12 | use serderust-analyzer cargo serde 1.0.228 crate/::{Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#, Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#, Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, Serializerrust-analyzer cargo serde_core 1.0.228 ser/Serializer#}; |
| 13 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#; |
| 14 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 15 | |
| 16 | impl<Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> ::precomputed_hashrust-analyzer cargo precomputed-hash 0.1.1 crate/::PrecomputedHashrust-analyzer cargo precomputed-hash 0.1.1 PrecomputedHash# for Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static> { |
| 17 | fn precomputed_hashrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][PrecomputedHash]precomputed_hash().(&self) -> u32 { |
| 18 | self.get_hashrust-analyzer cargo string_cache 0.9.0 atom/impl#[`Atom<Static>`]get_hash().() |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | impl<'a, Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'a Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static>> for Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static> { |
| 23 | fn fromrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`From<&'a Atom<Static>>`]from().(atom: &'a Selfrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`From<&'a Atom<Static>>`]) -> Selfrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`From<&'a Atom<Static>>`] { |
| 24 | atom.clonerust-analyzer cargo string_cache 0.9.0 atom/impl#[`Atom<Static>`][Clone]clone().() |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | impl<Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<str> for Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static> { |
| 29 | fn eqrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`PartialEq<str>`]eq().(&self, other: &str) -> bool { |
| 30 | &self[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().other |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | impl<Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static>> for str { |
| 35 | fn eqrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[str][`PartialEq<Atom<Static>>`]eq().(&self, other: &Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static>) -> bool { |
| 36 | self rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().&other[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | impl<Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static> { |
| 41 | fn eqrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`PartialEq<String>`]eq().(&self, other: &Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> bool { |
| 42 | self[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/impl#[str][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/impl#[str][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/impl#[str][`PartialEq<Self>`]eq().other[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | impl<'a, Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'a str> for Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static> { |
| 47 | #[inline] |
| 48 | fn fromrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`From<&'a str>`]from().(string_to_add: &str) -> Selfrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`From<&'a str>`] { |
| 49 | Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#::fromrust-analyzer cargo string_cache 0.9.0 atom/impl#[`Atom<Static>`][`From<Cow<'a, str>>`]from().(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(string_to_add)) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | impl<Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static> { |
| 54 | #[inline] |
| 55 | fn fromrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`From<String>`]from().(string_to_add: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Selfrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`From<String>`] { |
| 56 | Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#::fromrust-analyzer cargo string_cache 0.9.0 atom/impl#[`Atom<Static>`][`From<Cow<'a, str>>`]from().(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(string_to_add)) |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | impl<Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static> { |
| 61 | #[inline] |
| 62 | fn fmtrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 63 | <str as fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#>::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[str][Display]fmt().(self, f) |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | impl<Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str> for Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static> { |
| 68 | fn as_refrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`AsRef<str>`]as_ref().(&self) -> &str { |
| 69 | self |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | #[cfg(feature = "serde_support")] |
| 74 | impl<Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize# for Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static> { |
| 75 | fn serializerust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][Serialize]serialize().<S>(&self, serializer: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<S::Okrust-analyzer cargo serde_core 1.0.228 ser/Serializer#Ok#, S::Errorrust-analyzer cargo serde_core 1.0.228 ser/Serializer#Error#> |
| 76 | where |
| 77 | S: Serializerrust-analyzer cargo serde_core 1.0.228 ser/Serializer#, |
| 78 | { |
| 79 | let string: &str = self.as_refrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`AsRef<str>`]as_ref().(); |
| 80 | string.serializerust-analyzer cargo serde_core 1.0.228 ser/impls/impl#[str][Serialize]serialize().(serializer) |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | #[cfg(feature = "serde_support")] |
| 85 | impl<'a, Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#<'a> for Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static> { |
| 86 | fn deserializerust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`Deserialize<'a>`]deserialize().<D>(deserializer: D) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`Deserialize<'a>`], D::Errorrust-analyzer cargo serde_core 1.0.228 de/Deserializer#Error#> |
| 87 | where |
| 88 | D: Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#<'a>, |
| 89 | { |
| 90 | use serderust-analyzer cargo serde 1.0.228 crate/::derust-analyzer cargo serde_core 1.0.228 de/; |
| 91 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 92 | |
| 93 | struct AtomVisitorrust-analyzer cargo string_cache 0.9.0 trivial_impls/AtomVisitor#<Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#>(PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<Static>); |
| 94 | |
| 95 | impl<'de, Static: StaticAtomSetrust-analyzer cargo string_cache 0.9.0 static_sets/StaticAtomSet#> derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de> for AtomVisitorrust-analyzer cargo string_cache 0.9.0 trivial_impls/AtomVisitor#<Static> { |
| 96 | type Valuerust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`AtomVisitor<Static>`][`Visitor<'de>`]Value# = Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#<Static>; |
| 97 | |
| 98 | fn expectingrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`AtomVisitor<Static>`][`Visitor<'de>`]expecting().(&self, formatter: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 99 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(formatter, "an Atom") |
| 100 | } |
| 101 | |
| 102 | fn visit_strrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`AtomVisitor<Static>`][`Visitor<'de>`]visit_str().<E>(self, v: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`AtomVisitor<Static>`][`Visitor<'de>`]::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#, E> |
| 103 | where |
| 104 | E: derust-analyzer cargo serde_core 1.0.228 de/::Errorrust-analyzer cargo serde_core 1.0.228 de/Error#, |
| 105 | { |
| 106 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#::fromrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`From<&'a str>`]from().(v)) |
| 107 | } |
| 108 | |
| 109 | fn visit_stringrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`AtomVisitor<Static>`][`Visitor<'de>`]visit_string().<E>(self, v: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`AtomVisitor<Static>`][`Visitor<'de>`]::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#, E> |
| 110 | where |
| 111 | E: derust-analyzer cargo serde_core 1.0.228 de/::Errorrust-analyzer cargo serde_core 1.0.228 de/Error#, |
| 112 | { |
| 113 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Atomrust-analyzer cargo string_cache 0.9.0 atom/Atom#::fromrust-analyzer cargo string_cache 0.9.0 trivial_impls/impl#[`Atom<Static>`][`From<String>`]from().(v)) |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | deserializer.deserialize_strrust-analyzer cargo serde_core 1.0.228 de/Deserializer#deserialize_str().(AtomVisitorrust-analyzer cargo string_cache 0.9.0 trivial_impls/AtomVisitor#(PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#)) |
| 118 | } |
| 119 | } |