mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
move to EncodingRef
This commit is contained in:
@@ -118,7 +118,7 @@ fn get_encoded_data(corrected_bits: &[bool]) -> Result<String, Exceptions> {
|
||||
// when character encoding changes (ECI) or input ends.
|
||||
let mut decoded_bytes: Vec<u8> = Vec::new();
|
||||
// let mut encdr: &'static dyn encoding::Encoding = encoding::all::UTF_8;
|
||||
let mut encdr: &'static dyn encoding::Encoding = encoding::all::ISO_8859_1;
|
||||
let mut encdr: encoding::EncodingRef = encoding::all::ISO_8859_1;
|
||||
|
||||
let mut index = 0;
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ pub fn encode_with_charset(
|
||||
data: &str,
|
||||
minECCPercent: u32,
|
||||
userSpecifiedLayers: i32,
|
||||
charset: &'static dyn encoding::Encoding,
|
||||
charset: encoding::EncodingRef,
|
||||
) -> Result<AztecCode, Exceptions> {
|
||||
let bytes = charset
|
||||
.encode(data, encoding::EncoderTrap::Strict)
|
||||
@@ -148,7 +148,7 @@ pub fn encode_bytes_with_charset(
|
||||
data: &[u8],
|
||||
min_eccpercent: u32,
|
||||
user_specified_layers: i32,
|
||||
charset: &'static dyn encoding::Encoding,
|
||||
charset: encoding::EncodingRef,
|
||||
) -> Result<AztecCode, Exceptions> {
|
||||
// High-level encode
|
||||
let bits = HighLevelEncoder::with_charset(data.into(), charset).encode()?;
|
||||
|
||||
@@ -37,7 +37,7 @@ use super::{State, Token};
|
||||
*/
|
||||
pub struct HighLevelEncoder {
|
||||
text: Vec<u8>,
|
||||
charset: &'static dyn encoding::Encoding,
|
||||
charset: encoding::EncodingRef,
|
||||
}
|
||||
|
||||
impl HighLevelEncoder {
|
||||
@@ -235,7 +235,7 @@ impl HighLevelEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_charset(text: Vec<u8>, charset: &'static dyn encoding::Encoding) -> Self {
|
||||
pub fn with_charset(text: Vec<u8>, charset: encoding::EncodingRef) -> Self {
|
||||
Self { text, charset }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user