Closed haochiya closed 3 years ago
Hi.
The From<&str> for Opts
impl was removed in v21, sorry for not mentioning in the release notes. I'll migrate to TryFrom
in the future, but for now please use Opts::from_url
:
use mysql::*;
use mysql::prelude::*;
fn main() {
let url = "mysql://root:password@localhost:3307/db_name";
let opts = Opts::from_url(url).unwrap();
let pool = Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();
Thank you!
CODE: use mysql::; use mysql::prelude::; fn main() { let url = "mysql://root:password@localhost:3307/db_name"; let pool = Pool::new(url).unwrap(); let mut conn = pool.get_conn().unwrap(); .... }
ERROR: let pool = Pool::new(url).unwrap(); the trait 'From<&str>' is not implemented for 'Opts'