pub struct OptimizedTextItem {
pub text: String,
pub text_type: OptimizedTextType,
pub node: Handle,
pub tag_name: Cow<'static, str>,
pub hash: u64,
}
Expand description
优化的文本项
Fields§
§text: String
文本内容
text_type: OptimizedTextType
文本类型
node: Handle
对应的DOM节点
tag_name: Cow<'static, str>
标签名称(使用Cow避免不必要的分配)
hash: u64
缓存的哈希值(用于去重和缓存查找)
Implementations§
Source§impl OptimizedTextItem
impl OptimizedTextItem
Sourcepub fn new(
text: String,
text_type: OptimizedTextType,
node: Handle,
tag_name: &str,
) -> Self
pub fn new( text: String, text_type: OptimizedTextType, node: Handle, tag_name: &str, ) -> Self
创建新的优化文本项
Sourcepub fn apply_translation_optimized(
&self,
translation: &str,
) -> TranslationResult<()>
pub fn apply_translation_optimized( &self, translation: &str, ) -> TranslationResult<()>
应用翻译到DOM节点(优化版本)
Trait Implementations§
Source§impl Clone for OptimizedTextItem
impl Clone for OptimizedTextItem
Source§fn clone(&self) -> OptimizedTextItem
fn clone(&self) -> OptimizedTextItem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for OptimizedTextItem
impl !RefUnwindSafe for OptimizedTextItem
impl !Send for OptimizedTextItem
impl !Sync for OptimizedTextItem
impl Unpin for OptimizedTextItem
impl !UnwindSafe for OptimizedTextItem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more