docs

core::encoding

本页内容

API 参考只有英文版,由标准库源代码中的英文文档注释生成。

bytes as text (RFC 4648): hex and base64. Encoders return str or fill a SliceMut<u8>; decoders return List<u8> or fill a SliceMut<u8>, and throw DecodeError naming the byte offset of the first problem.

Modules

  • base64 base64 (RFC 4648 sections 4 and 5).
  • hex base16 (RFC 4648 section 8): two digits per byte.

Structs

DecodeErrorSource

pub struct DecodeError

Text that hex::decode or base64::decode cannot decode.

  • pub const fn kind(self) -> DecodeErrorKind§

    Source

    What kind of input was rejected.

  • pub const fn position(self) -> usize§

    Source

    The byte offset in the text where decoding failed.

  • pub const fn message(self) -> str§

    Source

    What went wrong and what to write instead.

Trait implementations 3
  • impl Display for DecodeError
  • impl Debug for DecodeError
  • impl Error for DecodeError

Enums

DecodeErrorKindSource

pub enum DecodeErrorKind

What a DecodeError is about.

  • InvalidByte§

    Source

    A byte that is not in the alphabet.

  • InvalidLength§

    Source

    A text whose length no encoded text has.

  • InvalidPadding§

    Source

    Padding where the codec takes none, missing where it needs it, or of the wrong length.