From efa8dbbc406a33b8c96108334108ae8df80d9c3a Mon Sep 17 00:00:00 2001 From: EmperorBale Date: Fri, 15 Jul 2022 18:18:35 -0700 Subject: [PATCH] chore: Rename AvmUtf8Decoder to DecodeAvmUtf8 --- wstr/src/buf.rs | 8 +++----- wstr/src/utils.rs | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/wstr/src/buf.rs b/wstr/src/buf.rs index 0144b11d1..40c6391f2 100644 --- a/wstr/src/buf.rs +++ b/wstr/src/buf.rs @@ -6,9 +6,7 @@ use core::mem::{self, ManuallyDrop}; use core::ops::{Deref, DerefMut}; use core::ptr::{self, NonNull}; -use super::utils::{ - encode_raw_utf16, split_ascii_prefix, split_ascii_prefix_bytes, AvmUtf8Decoder, -}; +use super::utils::{encode_raw_utf16, split_ascii_prefix, split_ascii_prefix_bytes, DecodeAvmUtf8}; use super::{Units, WStr, MAX_STRING_LEN}; /// An owned, extensible UCS2 string, analoguous to `String`. @@ -112,11 +110,11 @@ impl WString { return Self::from_buf(b); } - let is_wide = AvmUtf8Decoder::new(tail).any(|ch| ch > u8::MAX.into()); + let is_wide = DecodeAvmUtf8::new(tail).any(|ch| ch > u8::MAX.into()); if is_wide { let mut buf = Vec::new(); buf.extend(ascii.iter().map(|c| u16::from(*c))); - for ch in AvmUtf8Decoder::new(tail) { + for ch in DecodeAvmUtf8::new(tail) { encode_raw_utf16(ch, &mut buf); } Self::from_buf(buf) diff --git a/wstr/src/utils.rs b/wstr/src/utils.rs index ac9d9af1d..7695dc92e 100644 --- a/wstr/src/utils.rs +++ b/wstr/src/utils.rs @@ -112,18 +112,18 @@ pub fn swf_to_uppercase(c: u16) -> u16 { /// Another difference is that if a multibyte sequence is expecting 4 bytes, rather than failing/replacing with a /// replacement character since the maximum is 3, Flash will instead just only read the next 3 bytes and completely /// ignore the fact that the starting byte was expecting 4. -pub struct AvmUtf8Decoder<'a> { +pub struct DecodeAvmUtf8<'a> { src: &'a [u8], index: usize, } -impl<'a> AvmUtf8Decoder<'a> { +impl<'a> DecodeAvmUtf8<'a> { pub fn new(src: &'a [u8]) -> Self { Self { src, index: 0 } } } -impl<'a> Iterator for AvmUtf8Decoder<'a> { +impl<'a> Iterator for DecodeAvmUtf8<'a> { type Item = u32; fn next(&mut self) -> Option { let mut ch: u32;