&'a &Vec<Object>
&'a [Object]
instead of &'a Vec<Object>
, because you don't use any vec specific methods.
let mut strings: Vec<&str> = data.split_whitespace().collect();
strings.sort();
Response::Errors
contains a reference to?
Box
and Vec
instead of references
Add
, not Sum
std::env::set_var("RUST_BACKTRACE", "1");
set RUST_BACKTRACE=1
should work too :\

69  let () = v.sum();
 ^^ expected associated type, found ()

= note: expected type `<A as Sum>::output`
found type `()`
output
type that can be converted to f64
.
<A as Sum>::output
so you should provide some conversion method yourself
as
.
Add
bound
doit
isn't defined just for NumbersI
, it's defined for anything that implements your Sum
and Div
traits.
fn doit<A>(v: &A) > f64
where
A: Sum + Div,
<A as Sum>::output: std::ops::Add<f64, Output = f64>,
{
match v.div() {
Ok(f) => v.sum() + f,
Err(_) => 0f64
}
}
Add<f64>
.
impl Into<f64> for isize
(or impl From<isize> for f64
) either, so you need yet another solution ^^
error[E0277]: the trait bound `f64: std::convert::From<i64>` is not satisfied
> src/main.rs:85:20

85  println!("{}", doit(&n));
 ^^^^ the trait `std::convert::From<i64>` is not implemented for `f64`

= help: the following implementations were found:
<f64 as std::convert::From<i8>>
<f64 as std::convert::From<i16>>
<f64 as std::convert::From<f32>>
<f64 as std::convert::From<u16>>
and 3 others
= note: required because of the requirements on the impl of `std::convert::Into<f64>` for `i64`
= note: required by `doit`
From
/ Into
only allow lossless conversions
trace_macro
https://stackoverflow.com/questions/30200374/howdoidebugmacros
wow, didn't know about this
from_str_radix
can handle up to base 36 (which I can deal with). Is there a way to convert to base 36 from base 10?
from_str_radix
; builtin conversions are for: base2, base10, and base16
09
, then az
). However, the set of digits for base 38 is not obvious.