| 1 | use superrust-analyzer cargo fluent-uri 0.4.1 pct_enc/::{Assertrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Assert#, EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#, Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#}; |
| 2 | use craterust-analyzer cargo fluent-uri 0.4.1 crate/::{pct_encrust-analyzer cargo fluent-uri 0.4.1 pct_enc/::Encoderust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encode#, utf8rust-analyzer cargo fluent-uri 0.4.1 utf8/::Utf8Chunksrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#}; |
| 3 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::{borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::ToOwnedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned#, stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#}; |
| 4 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/::Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#, cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#, fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/, hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/, 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#, opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#}; |
| 5 | |
| 6 | /// A percent-encoded, growable string. |
| 7 | /// |
| 8 | /// The borrowed counterpart of `EString` is [`EStr`]. |
| 9 | /// See its documentation for the meaning of the type parameter `E`. |
| 10 | /// |
| 11 | /// # Comparison |
| 12 | /// |
| 13 | /// `EString`s are compared [lexicographically](Ord#lexicographical-comparison) |
| 14 | /// by their byte values. Normalization is **not** performed prior to comparison. |
| 15 | /// |
| 16 | /// # Examples |
| 17 | /// |
| 18 | /// Encode key-value pairs to a query string and use it to build a URI reference: |
| 19 | /// |
| 20 | /// ``` |
| 21 | /// use fluent_uri::{ |
| 22 | /// pct_enc::{ |
| 23 | /// encoder::{Data, Query}, |
| 24 | /// EStr, EString, Encoder, Table, |
| 25 | /// }, |
| 26 | /// UriRef, |
| 27 | /// }; |
| 28 | /// |
| 29 | /// let pairs = [("name", "张三"), ("speech", "¡Olé!")]; |
| 30 | /// let mut buf = EString::<Query>::new(); |
| 31 | /// for (k, v) in pairs { |
| 32 | /// if !buf.is_empty() { |
| 33 | /// buf.push('&'); |
| 34 | /// } |
| 35 | /// |
| 36 | /// // WARNING: Absolutely do not confuse data with delimiters! |
| 37 | /// // Use `Data` (or `IData`) to encode data contained in a URI |
| 38 | /// // (or an IRI) unless you know what you're doing! |
| 39 | /// buf.encode_str::<Data>(k); |
| 40 | /// buf.push('='); |
| 41 | /// buf.encode_str::<Data>(v); |
| 42 | /// } |
| 43 | /// |
| 44 | /// assert_eq!(buf, "name=%E5%BC%A0%E4%B8%89&speech=%C2%A1Ol%C3%A9%21"); |
| 45 | /// |
| 46 | /// let uri_ref = UriRef::builder() |
| 47 | /// .path(EStr::EMPTY) |
| 48 | /// .query(&buf) |
| 49 | /// .build() |
| 50 | /// .unwrap(); |
| 51 | /// assert_eq!(uri_ref.as_str(), "?name=%E5%BC%A0%E4%B8%89&speech=%C2%A1Ol%C3%A9%21"); |
| 52 | /// ``` |
| 53 | /// |
| 54 | /// Encode a path whose segments may contain the slash (`'/'`) character |
| 55 | /// by using a custom sub-encoder: |
| 56 | /// |
| 57 | /// ``` |
| 58 | /// use fluent_uri::pct_enc::{encoder::Path, EString, Encoder, Table}; |
| 59 | /// |
| 60 | /// struct PathSegment; |
| 61 | /// |
| 62 | /// impl Encoder for PathSegment { |
| 63 | /// const TABLE: &'static Table = &Path::TABLE.sub(&Table::new(b"/")); |
| 64 | /// } |
| 65 | /// |
| 66 | /// let mut path = EString::<Path>::new(); |
| 67 | /// path.push('/'); |
| 68 | /// path.encode_str::<PathSegment>("foo/bar"); |
| 69 | /// |
| 70 | /// assert_eq!(path, "/foo%2Fbar"); |
| 71 | /// ``` |
| 72 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 73 | pub struct EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> { |
| 74 | pub(craterust-analyzer cargo fluent-uri 0.4.1 crate/) bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 75 | encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#encoder.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<E>, |
| 76 | } |
| 77 | |
| 78 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 79 | type Targetrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][Deref]Target# = EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E>; |
| 80 | |
| 81 | fn derefrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][Deref]deref().(&self) -> &EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E> { |
| 82 | EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#::new_validatedrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]new_validated().(&self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf.) |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 87 | pub(craterust-analyzer cargo fluent-uri 0.4.1 crate/) fn new_validatedrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]new_validated().(buf: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Selfrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`] { |
| 88 | Selfrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`] { |
| 89 | bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf., |
| 90 | encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#encoder.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | /// Creates a new empty `EString`. |
| 95 | #[must_use] |
| 96 | pub fn newrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]new().() -> Selfrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`] { |
| 97 | Selfrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]::new_validatedrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]new_validated().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()) |
| 98 | } |
| 99 | |
| 100 | /// Creates a new empty `EString` with at least the specified capacity. |
| 101 | #[must_use] |
| 102 | pub fn with_capacityrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]with_capacity().(capacity: usize) -> Selfrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`] { |
| 103 | Selfrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]::new_validatedrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]new_validated().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]with_capacity().(capacity)) |
| 104 | } |
| 105 | |
| 106 | /// Coerces to an `EStr` slice. |
| 107 | #[must_use] |
| 108 | pub fn as_estrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]as_estr().(&self) -> &EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E> { |
| 109 | self |
| 110 | } |
| 111 | |
| 112 | /// Returns this `EString`'s capacity, in bytes. |
| 113 | #[must_use] |
| 114 | pub fn capacityrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]capacity().(&self) -> usize { |
| 115 | self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf..capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]capacity().() |
| 116 | } |
| 117 | |
| 118 | /// Encodes a string with a sub-encoder and appends the result onto the end of this `EString`. |
| 119 | /// |
| 120 | /// A character will be preserved if `SubE::TABLE` [allows] it and percent-encoded otherwise. |
| 121 | /// |
| 122 | /// In most cases, use [`Data`] (for URI) or [`IData`] (for IRI) as the sub-encoder. |
| 123 | /// When using other sub-encoders, make sure that `SubE::TABLE` does not [allow][allows] |
| 124 | /// the component delimiters that delimit the data. |
| 125 | /// |
| 126 | /// Note that this method will **not** encode `U+0020` (space) as `U+002B` (+). |
| 127 | /// |
| 128 | /// [allows]: super::Table::allows |
| 129 | /// [`Data`]: super::encoder::Data |
| 130 | /// [`IData`]: super::encoder::IData |
| 131 | /// |
| 132 | /// # Panics |
| 133 | /// |
| 134 | /// Panics at compile time if `SubE` is not a [sub-encoder](Encoder#sub-encoders) of `E`, |
| 135 | /// or if `SubE::TABLE` does not [allow percent-encoded octets]. |
| 136 | /// |
| 137 | /// [allow percent-encoded octets]: super::Table::allows_pct_encoded |
| 138 | pub fn encode_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]encode_str().<SubE: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#>(&mut self, s: &str) { |
| 139 | () = Assertrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Assert#::<SubE, E>::L_IS_SUB_ENCODER_OF_Rrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`Assert<L, R>`]L_IS_SUB_ENCODER_OF_R.; |
| 140 | () = EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#::<SubE>::ASSERT_ALLOWS_PCT_ENCODEDrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]ASSERT_ALLOWS_PCT_ENCODED.; |
| 141 | |
| 142 | for chunk in Encoderust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encode#::newrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`Encode<'t, 's>`]new().(SubE::TABLErust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#TABLE., s) { |
| 143 | self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf..push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(chunk.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EncodedChunk<'a>`]as_str().()); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | /// Encodes a byte sequence with a sub-encoder and appends the result onto the end of this `EString`. |
| 148 | /// |
| 149 | /// A byte will be preserved if it is part of a UTF-8-encoded character |
| 150 | /// that `SubE::TABLE` [allows] and percent-encoded otherwise. |
| 151 | /// |
| 152 | /// In most cases, use [`Data`] (for URI) or [`IData`] (for IRI) as the sub-encoder. |
| 153 | /// When using other sub-encoders, make sure that `SubE::TABLE` does not [allow][allows] |
| 154 | /// the component delimiters that delimit the data. |
| 155 | /// |
| 156 | /// Note that this method will **not** encode `0x20` (space) as `U+002B` (+). |
| 157 | /// |
| 158 | /// If you need to encode a string, use [`encode_str`][Self::encode_str] instead. |
| 159 | /// |
| 160 | /// [allows]: super::Table::allows |
| 161 | /// [`Data`]: super::encoder::Data |
| 162 | /// [`IData`]: super::encoder::IData |
| 163 | /// |
| 164 | /// # Deprecation |
| 165 | /// |
| 166 | /// This method is deprecated because percent-encoding non-UTF-8 bytes is |
| 167 | /// a non-standard operation. If you're developing a new protocol, use |
| 168 | /// other encodings such as Base64 instead. If you absolutely must, here's |
| 169 | /// a workaround: |
| 170 | /// |
| 171 | /// ``` |
| 172 | /// use fluent_uri::pct_enc::{encoder::Path, EStr, EString}; |
| 173 | /// |
| 174 | /// let mut buf = EString::<Path>::new(); |
| 175 | /// |
| 176 | /// for chunk in b"D\xFCrst".utf8_chunks() { |
| 177 | /// buf.encode_str::<Path>(chunk.valid()); |
| 178 | /// for &x in chunk.invalid() { |
| 179 | /// buf.push_estr(EStr::encode_byte(x)); |
| 180 | /// } |
| 181 | /// } |
| 182 | /// |
| 183 | /// assert_eq!(buf, "D%FCrst"); |
| 184 | /// ``` |
| 185 | /// |
| 186 | /// # Panics |
| 187 | /// |
| 188 | /// Panics at compile time if `SubE` is not a [sub-encoder](Encoder#sub-encoders) of `E`, |
| 189 | /// or if `SubE::TABLE` does not [allow percent-encoded octets]. |
| 190 | /// |
| 191 | /// [allow percent-encoded octets]: super::Table::allows_pct_encoded |
| 192 | #[deprecated = "use `<[u8]>::utf8_chunks`, `EString::encode_str`, `EStr::encode_byte`, and `EString::push_estr` instead"] |
| 193 | pub fn encode_bytesrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]encode_bytes().<SubE: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#>(&mut self, bytes: &[u8]) { |
| 194 | () = Assertrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Assert#::<SubE, E>::L_IS_SUB_ENCODER_OF_Rrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`Assert<L, R>`]L_IS_SUB_ENCODER_OF_R.; |
| 195 | () = EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#::<SubE>::ASSERT_ALLOWS_PCT_ENCODEDrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]ASSERT_ALLOWS_PCT_ENCODED.; |
| 196 | |
| 197 | for chunk in Utf8Chunksrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#::newrust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunks<'a>`]new().(bytes) { |
| 198 | for chunk in Encoderust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encode#::newrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`Encode<'t, 's>`]new().(SubE::TABLErust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#TABLE., chunk.validrust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunk<'a>`]valid().()) { |
| 199 | self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf..push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(chunk.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EncodedChunk<'a>`]as_str().()); |
| 200 | } |
| 201 | for &x in chunk.invalidrust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunk<'a>`]invalid().() { |
| 202 | self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf..push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(superrust-analyzer cargo fluent-uri 0.4.1 pct_enc/::encode_byterust-analyzer cargo fluent-uri 0.4.1 pct_enc/encode_byte().(x)); |
| 203 | } |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | /// Appends an unencoded character onto the end of this `EString`. |
| 208 | /// |
| 209 | /// # Panics |
| 210 | /// |
| 211 | /// Panics if `E::TABLE` does not [allow] the character. |
| 212 | /// |
| 213 | /// [allow]: super::Table::allows |
| 214 | pub fn pushrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]push().(&mut self, ch: char) { |
| 215 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(E::TABLErust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#TABLE..allowsrust-analyzer cargo fluent-uri 0.4.1 pct_enc/table/impl#[Table]allows().(ch), "table does not allow the char"); |
| 216 | self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(ch); |
| 217 | } |
| 218 | |
| 219 | /// Appends an `EStr` slice onto the end of this `EString`. |
| 220 | pub fn push_estrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]push_estr().(&mut self, s: &EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E>) { |
| 221 | self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf..push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(s.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().()); |
| 222 | } |
| 223 | |
| 224 | /// Truncates this `EString`, removing all contents. |
| 225 | pub fn clearrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]clear().(&mut self) { |
| 226 | self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]clear().(); |
| 227 | } |
| 228 | |
| 229 | /// Consumes this `EString` and yields the underlying `String`. |
| 230 | #[must_use] |
| 231 | pub fn into_stringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`]into_string().(self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 232 | self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf. |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E>> for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 237 | fn as_refrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`AsRef<EStr<E>>`]as_ref().(&self) -> &EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E> { |
| 238 | self |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str> for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 243 | fn as_refrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`AsRef<str>`]as_ref().(&self) -> &str { |
| 244 | &self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf. |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E>> for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 249 | fn borrowrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`Borrow<EStr<E>>`]borrow().(&self) -> &EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E> { |
| 250 | self |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E>> for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 255 | fn fromrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`From<&EStr<E>>`]from().(s: &EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E>) -> Selfrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`From<&EStr<E>>`] { |
| 256 | s.to_ownedrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`][ToOwned]to_owned().() |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 261 | fn eqrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`PartialEq<Self>`]eq().(&self, other: &Selfrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`PartialEq<Self>`]) -> bool { |
| 262 | self.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() 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.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E>> for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 267 | fn eqrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`PartialEq<EStr<E>>`]eq().(&self, other: &EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E>) -> bool { |
| 268 | self.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() 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.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E>> for EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E> { |
| 273 | fn eqrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EStr<E>`][`PartialEq<EString<E>>`]eq().(&self, other: &EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E>) -> bool { |
| 274 | self.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() 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.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<&EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E>> for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 279 | fn eqrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`PartialEq<&EStr<E>>`]eq().(&self, other: &&EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E>) -> bool { |
| 280 | self.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() 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.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E>> for &EStrrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#<E> { |
| 285 | fn eqrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`&EStr<E>`][`PartialEq<EString<E>>`]eq().(&self, other: &EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E>) -> bool { |
| 286 | self.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() 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.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<str> for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 291 | fn eqrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`PartialEq<str>`]eq().(&self, other: &str) -> bool { |
| 292 | self.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() 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 |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E>> for str { |
| 297 | fn eqrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[str][`PartialEq<EString<E>>`]eq().(&self, other: &EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E>) -> bool { |
| 298 | 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.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<&str> for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 303 | fn eqrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`PartialEq<&str>`]eq().(&self, other: &&str) -> bool { |
| 304 | self.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() 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().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().other |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E>> for &str { |
| 309 | fn eqrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`&str`][`PartialEq<EString<E>>`]eq().(&self, other: &EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E>) -> bool { |
| 310 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().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.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().() |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> {} |
| 315 | |
| 316 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 317 | fn hashrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][Hash]hash().<H: hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#>(&self, state: &mut H) { |
| 318 | self.bufrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#buf..hashrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Hash]hash().(state); |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd# for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 323 | fn partial_cmprust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`PartialOrd<Self>`]partial_cmp().(&self, other: &Selfrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][`PartialOrd<Self>`]) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#> { |
| 324 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.cmprust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][Ord]cmp().(other)) |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 329 | fn cmprust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][Ord]cmp().(&self, other: &Selfrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][Ord]) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# { |
| 330 | self.innerrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#inner..cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/impl#[str][Ord]cmp().(&other.innerrust-analyzer cargo fluent-uri 0.4.1 pct_enc/EStr#inner.) |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 335 | fn fmtrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 336 | self.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().().fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[str][Debug]fmt().(f) |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | impl<E: Encoderrust-analyzer cargo fluent-uri 0.4.1 pct_enc/Encoder#> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for EStringrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/EString#<E> { |
| 341 | fn fmtrust-analyzer cargo fluent-uri 0.4.1 pct_enc/estring/impl#[`EString<E>`][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 342 | self.as_strrust-analyzer cargo fluent-uri 0.4.1 pct_enc/impl#[`EStr<E>`]as_str().().fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[str][Display]fmt().(f) |
| 343 | } |
| 344 | } |