sftool-lib 0.2.3

SiFli SoC serial utility library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use sftool_lib::{CancelToken, Error};

#[test]
fn cancel_token_reports_cancelled_state() {
    let token = CancelToken::new();
    assert!(!token.is_cancelled());
    assert!(token.check_cancelled().is_ok());

    token.cancel();

    assert!(token.is_cancelled());
    assert!(matches!(token.check_cancelled(), Err(Error::Cancelled)));
}