In the playground this won't work because it doesn't include that svg crate. Locally, on your machine, you'll have to create a cargo project (in case you haven't already and instead were using rustc manually before, you need to set up the project directory and files and then switch to using commands such as cargo check or cargo run), for an introduction see
The can add the dependency in the Cargo.toml file by adding the line advertised (under the heading/section “Install”) on the crate's crates.io page: https://crates.io/crates/svg, i.e. under the already existing [dependencies] section, you write