use libremetaverse_types::compat::CancellationTokenSource;

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), libremetaverse::Error> {
    let source = CancellationTokenSource::new();
    let token = source.token();
    source.cancel();
    token.cancelled().await;
    assert!(matches!(
        token.throw_if_cancellation_requested(),
        Err(libremetaverse::Error::Cancelled)
    ));
    Ok(())
}
