11use crate :: * ;
22
33impl < ' a > Default for Endecode < ' a > {
4- #[ inline]
54 fn default ( ) -> Self {
65 Endecode { charset : "" }
76 }
87}
98
109impl < ' a > Endecode < ' a > {
1110 /// Creates a new instance of `Endecode` with a default charset.
12- #[ inline]
1311 pub fn new ( ) -> Self {
1412 Endecode :: default ( )
1513 }
@@ -18,7 +16,6 @@ impl<'a> Endecode<'a> {
1816 ///
1917 /// # Returns
2018 /// Returns `true` if `charset` contains `CHARSET_LEN` unique characters, otherwise returns `false`.
21- #[ inline]
2219 pub ( crate ) fn judge_charset_safe ( charset : & str ) -> bool {
2320 let mut hash_set: HashSet < char > = HashSet :: new ( ) ;
2421 for tmp_char in charset. chars ( ) {
@@ -37,7 +34,6 @@ impl<'a> Endecode<'a> {
3734 ///
3835 /// # Returns
3936 /// Returns a mutable reference to `Self` for method chaining.
40- #[ inline]
4137 pub fn charset < ' b > ( & mut self , charset : & ' b str ) -> & mut Self
4238 where
4339 ' b : ' a ,
@@ -52,23 +48,21 @@ impl<'a> Endecode<'a> {
5248 /// encodes a string based on the current `charset`.
5349 ///
5450 /// # Parameters
55- /// - `encode_str`: The string slice to be encodeed .
51+ /// - `encode_str`: The string slice to be encoded .
5652 ///
5753 /// # Returns
58- /// Returns a `Result` containing the encodeed `String` if successful, or a `EncodeError` if the charset is invalid.
59- #[ inline]
54+ /// Returns a `Result` containing the encoded `String` if successful, or a `EncodeError` if the charset is invalid.
6055 pub fn encode ( & self , encode_str : & str ) -> Result < String , EncodeError > {
6156 encode ( self . charset , encode_str)
6257 }
6358
6459 /// decodes a string based on the current `charset`.
6560 ///
6661 /// # Parameters
67- /// - `decode_str`: The string slice to be decodeed .
62+ /// - `decode_str`: The string slice to be decoded .
6863 ///
6964 /// # Returns
70- /// Returns a `Result` containing the decodeed `String` if successful, or a `DecodeError` if the charset is invalid.
71- #[ inline]
65+ /// Returns a `Result` containing the decoded `String` if successful, or a `DecodeError` if the charset is invalid.
7266 pub fn decode ( & self , decode_str : & str ) -> Result < String , DecodeError > {
7367 decode ( self . charset , decode_str)
7468 }
0 commit comments