MCPcopy Index your code
hub / github.com/bedroombuilds/python2rust / double_first

Function double_first

0a_error_handling/rust/boilerplate.rs:17–21  ·  view source on GitHub ↗
(vec: Vec<&str>)

Source from the content-addressed store, hash-verified

15impl error::Error for EmptyVec {}
16
17fn double_first(vec: Vec<&str>) -> Result<i32> {
18 let first = vec.first().ok_or(EmptyVec)?;
19 let parsed = first.parse::<i32>()?;
20 Ok(2 * parsed)
21}
22
23fn print(result: Result<i32>) {
24 match result {

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected