rust_droid/action/
text.rs

1use crate::{Droid, Result};
2
3/// 用于构建和执行 "text" (输入文本) 操作。
4pub struct TextBuilder<'a> {
5    droid: &'a mut Droid,
6    text: String,
7}
8
9impl<'a> TextBuilder<'a> {
10    pub fn new(droid: &'a mut Droid, text: &str) -> Self {
11        Self {
12            droid,
13            text: text.to_string(),
14        }
15    }
16
17    /// 执行文本输入操作。
18    pub fn execute(self) -> Result<()> {
19        log::info!("Executing text input: '{}'", self.text);
20        self.droid.controller.input_text(&self.text)
21    }
22}