Skip to content

Commit 31c71b4

Browse files
committed
feat: v0.1.1
1 parent 6f25dd5 commit 31c71b4

File tree

5 files changed

+7
-17
lines changed

5 files changed

+7
-17
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bin-encode-decode"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2024"
55
authors = ["ltpp-universe <root@ltpp.vip>"]
66
license = "MIT"

src/common/error.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pub enum EncodeError {
66
}
77

88
impl fmt::Display for EncodeError {
9-
#[inline]
109
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1110
match self {
1211
EncodeError::CharsetError => write!(
@@ -24,7 +23,6 @@ pub enum DecodeError {
2423
}
2524

2625
impl fmt::Display for DecodeError {
27-
#[inline]
2826
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2927
match self {
3028
DecodeError::CharsetError => write!(

src/common/impl.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
use crate::*;
22

33
impl<'a> Default for Endecode<'a> {
4-
#[inline]
54
fn default() -> Self {
65
Endecode { charset: "" }
76
}
87
}
98

109
impl<'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
}

src/decode/func.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::*;
1111
/// the provided `charset`.
1212
///
1313
/// # Returns
14-
/// Returns a `Result` containing the decodeed `String` if successful, or a `DecodeError` if the charset is invalid.
14+
/// Returns a `Result` containing the decoded `String` if successful, or a `DecodeError` if the charset is invalid.
1515
///
1616
/// # Example
1717
/// ```
@@ -22,7 +22,6 @@ use crate::*;
2222
/// let decoded_str = decode(charset, encoded_str);
2323
/// assert_eq!(decoded_str.unwrap(), "test");
2424
/// ```
25-
#[inline]
2625
pub fn decode(charset: &str, decode_str: &str) -> Result<String, DecodeError> {
2726
if !Endecode::judge_charset_safe(charset) {
2827
return Err(DecodeError::CharsetError);

src/encode/func.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::*;
1010
/// in 3-byte chunks.
1111
///
1212
/// # Returns
13-
/// Returns a `Result` containing the encodeed `String` if successful, or a `EncodeError` if the charset is invalid.
13+
/// Returns a `Result` containing the encoded `String` if successful, or a `EncodeError` if the charset is invalid.
1414
///
1515
/// # Example
1616
/// ```
@@ -21,7 +21,6 @@ use crate::*;
2121
/// let encoded_str = encode(charset, original_str);
2222
/// assert_eq!(encoded_str.unwrap(), "aab0aabLaabZaab0");
2323
/// ```
24-
#[inline]
2524
pub fn encode(charset: &str, encode_str: &str) -> Result<String, EncodeError> {
2625
if !Endecode::judge_charset_safe(charset) {
2726
return Err(EncodeError::CharsetError);

0 commit comments

Comments
 (0)