# Path Extractor
The web::Path extractor provides a type-safe way to access parameters defined in your route's path. We touched on this in routing, but let's dive deeper into extraction.
#Single Parameters
If you only need a single parameter, you can extract it as a single type.
code_blocksrust
use actix_web::{get, web};
#[get("/user/{id}")]
async fn get_user(id: web::Path<i32>) -> String {
format!("User ID: {}", id)
}#Complex Parameters
For multiple parameters, it is best practice to define a struct. Actix Web extracts the variables in the order they appear if using a tuple, or by name if using a struct.
code_blocksrust
use actix_web::{get, web};
use serde::Deserialize;
#[derive(Deserialize)]
struct Location {
country: String,
city: String,
}
#[get("/weather/{country}/{city}")]
async fn weather(loc: web::Path<Location>) -> String {
format!("Weather for {}, {}", loc.city, loc.country)
}