Skip to main content

Module base64

Module base64 

Source
Expand description

base64 encoding and decoding.

This module provides base64 encoding/decoding using a 64-character alphabet. Both padded and unpadded variants are available.

Constants§

PADDED
Padded base64 encoding (alias of STD).
RAW
Raw base64 encoding without padding.
STD
Standard base64 encoding with padding.

Functions§

decode
Decodes base64 encoded bytes with padding.
decode_len
Returns the decoded output length for padded input.
decode_mut
Decodes base64 encoded bytes into a mutable buffer with padding.
decode_n
Decodes a fixed-size base64 array with padding.
decode_raw
Decodes base64 encoded bytes without padding.
decode_raw_len
Returns the decoded output length for unpadded input.
decode_raw_mut
Decodes base64 encoded bytes into a mutable buffer without padding.
decode_raw_n
Decodes a fixed-size base64 array without padding.
decode_writer
Creates a decoding writer that wraps an io::Write.\n\nThe writer buffers base64 encoded bytes with padding, decodes them, and writes the raw output to the inner writer.\n\n# Examples\n\n\nuse omp_core::base64;\nuse std::io::Write;\n\nlet mut output = Vec::new();\nlet encoded = base64::encode(b\"Hello\").into_vec();\nlet mut writer = base64::decode_writer(&mut output);\nwriter.write_all(&encoded).unwrap();\nwriter.flush().unwrap();\nassert_eq!(output, b\"Hello\");\n\n
decode_writer_raw
Creates a decoding writer for unpadded base64.\n\nThe writer buffers base64 encoded bytes without padding, decodes them, and writes the raw output to the inner writer.\n\n# Examples\n\n\nuse omp_core::base64;\nuse std::io::Write;\n\nlet mut output = Vec::new();\nlet encoded = base64::encode_raw(b\"Hello\").into_vec();\nlet mut writer = base64::decode_writer_raw(&mut output);\nwriter.write_all(&encoded).unwrap();\nwriter.flush().unwrap();\nassert_eq!(output, b\"Hello\");\n\n
encode
Encodes a byte slice to base64 with padding.
encode_len
Returns the encoded length including padding.
encode_mut
Encodes bytes into a mutable buffer with padding.
encode_n
Encodes a fixed-size byte array to base64 with padding.
encode_raw
Encodes a byte slice to base64 without padding.
encode_raw_len
Returns the encoded length without padding.
encode_raw_mut
Encodes bytes into a mutable buffer without padding.
encode_raw_n
Encodes a fixed-size byte array to base64 without padding.
encode_writer
Creates an encoding writer that wraps an io::Write.\n\nThe writer buffers raw bytes, encodes them to base64 with padding, and writes the encoded output to the inner writer.\n\n# Examples\n\n\nuse omp_core::base64;\nuse std::io::Write;\n\nlet mut output = Vec::new();\nlet mut writer = base64::encode_writer(&mut output);\nwriter.write_all(b\"Hello\").unwrap();\nwriter.flush().unwrap();\n\n
encode_writer_raw
Creates an encoding writer for unpadded base64.\n\nThe writer buffers raw bytes, encodes them to base64 without padding, and writes the encoded output to the inner writer.\n\n# Examples\n\n\nuse omp_core::base64;\nuse std::io::Write;\n\nlet mut output = Vec::new();\nlet mut writer = base64::encode_writer_raw(&mut output);\nwriter.write_all(b\"Hello\").unwrap();\nwriter.flush().unwrap();\n\n

Type Aliases§

Decoder
Streaming decoder for base64-encoded data.
Encoder
Streaming encoder for base64 encoding.
Encoding
Encoding dictionary for base64.