Skip to main content

split_name_and_scale

Function split_name_and_scale 

Source
pub fn split_name_and_scale(query: &str) -> Option<(&str, f64)>
Expand description

Split a name:factor query into its parts.

"pasta.cook:2" becomes ("pasta.cook", 2.0). Returns None when there is no colon, or when what follows the last one is not a number — so a Windows path like C:\recipes\pasta.cook is left alone. Spaces around the colon are dropped, so "pasta : 2" names pasta rather than pasta .

This is CookCLI’s command-line convention for naming a recipe and a scaling factor in one argument. read deliberately does not apply it: callers that accept arguments in that form split them here and fill in ReadRequest::scale themselves.