Unable to append a vector in a mutex to another vector
<p>I have a <code>Vec&lt;String&gt;</code> object that's being shared between threads via an <code>Arc&lt;Mutex&gt;</code>. I want to take its current value and append it to another vector elsewhere and then clear it:</p>

<pre><code>use std::thread;
use std::sync::{Arc, Mutex};

struct Store {
    lines: Vec&lt;String&gt;
}

fn main() {
    let mut store = Store { lines: vec![] };

    let lines = Arc::new(Mutex::new(vec!["Initial value".to_string()]));
    let lines_clone = lines.clone();

    let t2 = thread::spawn(move || {
        // populate lines
    });

    let t1 = thread::spawn(move || {
        let mut lines_result = lines_clone.lock().unwrap();
        store.lines.extend(lines_result); // This will not work
        lines_result.clear();
    });

    let _ = t1.join();
    let _ = t2.join();
}
</code></pre>

<p><code>extend</code> won't work because <code>lines_result</code> is actually a <code>MutexGuard</code> object. I can iterate over the object and append each element, but considering I'm clearing its values before it goes out of scope, is there a more efficient way?</p>