escriba_buffer/encoding.rs
1use serde::{Deserialize, Serialize};
2
3/// Encoding — phase 1 supports only UTF-8; Latin-1 / UTF-16 land in phase 2.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
5pub enum Encoding {
6 #[default]
7 Utf8,
8 Latin1,
9 Utf16Le,
10 Utf16Be,
11}
12
13impl Encoding {
14 #[must_use]
15 pub const fn as_str(self) -> &'static str {
16 match self {
17 Self::Utf8 => "utf-8",
18 Self::Latin1 => "latin1",
19 Self::Utf16Le => "utf-16le",
20 Self::Utf16Be => "utf-16be",
21 }
22 }
23}