Creating database within rust code

I thought it's a good idea for my webserver to have mock/test purpose db. I've looked up how crates.io handles it but got a bit confused. Here is reference to crates.io repo of what i can't understand. They have a function that should create a database based on template with all migrations.

They have TEST_DATABASE_URL env variable and it is set to valid database url, but it doesn't exist before function called. They somehow managed to execute sql query to create one, but they pass conn based on TEST_DATABASE_URL to execute(). Shouldn't that crash? There is no db yet, but we make a call there.

I guess it should've crashed on start in new function

If you are okay with no SQL database, then you can implement it fairly easy in Rust.