pub fn text<S: AsRef<str>>(data: S) -> Result<(), Error>Examples found in repository?
examples/text.rs (line 16)
5fn main() {
6 let start = Instant::now();
7 let mut rand = 0;
8 for _ in 0..1024 {
9 rand += start.elapsed().as_micros() % 1024;
10 }
11
12 let mut buffer = String::new();
13
14 let secret = format!("{SECRET}: {}", start.elapsed().as_micros() + rand);
15
16 blindcopy::text(&secret).unwrap();
17 println!("Your super secret string is: {secret:?}");
18 println!("It should have been copied. Paste back below to verify: ");
19 std::io::stdin().read_line(&mut buffer).unwrap();
20 buffer = buffer.trim().to_string();
21 if buffer == secret {
22 println!("It's the same! Now check your clipboard manager.");
23 } else {
24 println!("It's not the same. You pasted: {buffer:?}");
25 }
26}