File: thread.rs

package info (click to toggle)
rust-istring 0.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 140 kB
  • sloc: makefile: 4
file content (17 lines) | stat: -rw-r--r-- 375 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate istring;
use istring::IString;

use std::thread;
use std::fmt::Write;

#[test]
fn test_thread() {
    let mut s = IString::from("Hello");
    write!(s, " world").unwrap();
    let s2 = thread::spawn(move || {
        let mut s = s;
        s += " from another thread!";
        s
    }).join().unwrap();
    assert_eq!(s2, "Hello world from another thread!");
}