Refactor and other improvements
This commit is contained in:
parent
04a78e7bfe
commit
6c90cf3c0f
47 changed files with 2705 additions and 1568 deletions
|
|
@ -48,6 +48,17 @@ pub fn h3_cell_bounds(cell: h3o::CellIndex, buffer: f64) -> (f64, f64, f64, f64)
|
|||
)
|
||||
}
|
||||
|
||||
/// Require a bounds parameter, returning an error if absent, then parse it.
|
||||
pub fn require_bounds(
|
||||
bounds: Option<String>,
|
||||
) -> Result<(f64, f64, f64, f64), (StatusCode, String)> {
|
||||
let bounds_str = bounds.ok_or((
|
||||
StatusCode::BAD_REQUEST,
|
||||
"bounds parameter is required".into(),
|
||||
))?;
|
||||
parse_bounds(&bounds_str)
|
||||
}
|
||||
|
||||
pub fn parse_bounds(bounds_str: &str) -> Result<(f64, f64, f64, f64), (StatusCode, String)> {
|
||||
let parts: Vec<f64> = bounds_str
|
||||
.split(',')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue