Fixed build with --no-default-features #12

This commit is contained in:
Mauro D
2022-01-30 11:41:22 +00:00
parent beb21b3d03
commit 1a2ac1d027
2 changed files with 11 additions and 12 deletions
+9 -12
View File
@@ -12,9 +12,6 @@
#[cfg(feature = "full_encoding")]
use encoding_rs::*;
#[cfg(not(feature = "full_encoding"))]
use super::map::decoder_default;
#[cfg(feature = "full_encoding")]
fn multi_byte_decoder(mut decoder: Decoder, bytes: &[u8]) -> String {
let mut result = String::with_capacity(bytes.len() * 3);
@@ -35,7 +32,7 @@ pub fn decoder_shift_jis(bytes: &[u8]) -> String {
#[cfg(not(feature = "full_encoding"))]
{
decoder_default(bytes)
String::from_utf8_lossy(bytes).into_owned()
}
}
@@ -47,7 +44,7 @@ pub fn decoder_big5(bytes: &[u8]) -> String {
#[cfg(not(feature = "full_encoding"))]
{
decoder_default(bytes)
String::from_utf8_lossy(bytes).into_owned()
}
}
@@ -59,7 +56,7 @@ pub fn decoder_euc_jp(bytes: &[u8]) -> String {
#[cfg(not(feature = "full_encoding"))]
{
decoder_default(bytes)
String::from_utf8_lossy(bytes).into_owned()
}
}
@@ -71,7 +68,7 @@ pub fn decoder_euc_kr(bytes: &[u8]) -> String {
#[cfg(not(feature = "full_encoding"))]
{
decoder_default(bytes)
String::from_utf8_lossy(bytes).into_owned()
}
}
@@ -83,7 +80,7 @@ pub fn decoder_gb18030(bytes: &[u8]) -> String {
#[cfg(not(feature = "full_encoding"))]
{
decoder_default(bytes)
String::from_utf8_lossy(bytes).into_owned()
}
}
@@ -95,7 +92,7 @@ pub fn decoder_gbk(bytes: &[u8]) -> String {
#[cfg(not(feature = "full_encoding"))]
{
decoder_default(bytes)
String::from_utf8_lossy(bytes).into_owned()
}
}
@@ -107,7 +104,7 @@ pub fn decoder_iso2022_jp(bytes: &[u8]) -> String {
#[cfg(not(feature = "full_encoding"))]
{
decoder_default(bytes)
String::from_utf8_lossy(bytes).into_owned()
}
}
@@ -119,7 +116,7 @@ pub fn decoder_windows874(bytes: &[u8]) -> String {
#[cfg(not(feature = "full_encoding"))]
{
decoder_default(bytes)
String::from_utf8_lossy(bytes).into_owned()
}
}
@@ -131,6 +128,6 @@ pub fn decoder_ibm866(bytes: &[u8]) -> String {
#[cfg(not(feature = "full_encoding"))]
{
decoder_default(bytes)
String::from_utf8_lossy(bytes).into_owned()
}
}
+2
View File
@@ -1497,6 +1497,7 @@ impl<'x> Part<'x, MessageAttachment<'x>> {
}
}
#[cfg(feature = "serde_support")]
impl<'x> Serialize for MessageAttachment<'x> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@@ -1511,6 +1512,7 @@ impl<'x> Serialize for MessageAttachment<'x> {
}
}
#[cfg(feature = "serde_support")]
impl<'x, 'de> Deserialize<'de> for MessageAttachment<'x> {
fn deserialize<D>(_deserializer: D) -> Result<Self, D::Error>
where