Skip to content

Option::<bool>::from_value_opt behavior #148

@wqfish

Description

@wqfish

The following code prints Some(true).

let value = Value::Int(1);
let out = Option::<bool>::from_value_opt(value).unwrap();
println!("{:?}", out);

The following code panics:

let value = Value::UInt(1);
let out = Option::<bool>::from_value_opt(value).unwrap();
println!("{:?}", out)

Is it expected that Int(1) can be converted to Option<bool> while UInt(1) can't?

BTW I'm on version 0.25. The newer versions fail to compile (a bunch of tokio errors):

    Updating crates.io index
   Compiling mysql_async v0.26.0
error[E0425]: cannot find function `spawn` in crate `tokio`
  --> /Users/wqfish/.cargo/registry/src/github.com-1ecc6299db9ec823/mysql_async-0.26.0/src/conn/pool/ttl_check_inerval.rs:59:24
   |
59 |                 tokio::spawn(idling_conn.conn.disconnect().then(move |_| {
   |                        ^^^^^ not found in `tokio`
   |
help: consider importing one of these items
   |
9  | use crate::conn::pool::mpsc::list::thread::spawn;
   |
9  | use std::thread::spawn;
   |

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions