pub struct Decode {}Implementations§
Source§impl Decode
impl Decode
Sourcepub fn execute(charset: &str, decode_str: &str) -> Result<String, DecodeError>
pub fn execute(charset: &str, decode_str: &str) -> Result<String, DecodeError>
decodes a given encoded string based on a specified charset, using 4-character
groups to restore the original bytes. Each character in the decode_str string
is mapped to an index in charset to form the decoded bytes.
§Parameters
charset: A string representing the character set used to encode and decode the data. Each character should have a unique position incharset.decode_str: The string to be decoded, which was originally encoded with the providedcharset.
§Returns
Returns a Result containing the decoded String if successful, or a DecodeError if the charset is invalid.
§Example
use bin_encode_decode::*;
let charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_=";
let encoded_str = "aab0aabLaabZaab0";
let decoded_str = Decode::execute(charset, encoded_str);
assert_eq!(decoded_str.unwrap(), "test");Auto Trait Implementations§
impl Freeze for Decode
impl RefUnwindSafe for Decode
impl Send for Decode
impl Sync for Decode
impl Unpin for Decode
impl UnwindSafe for Decode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more