These are chat archives for rust-lang/rust
I'm building a string based on items in a list. I'm trying to use
list.into_iter() .enumerate .map(|(i,j)| mystring.push_str(&myfunc(i, j))) .collect()
The issue is I have to specify the type for
collect and I could do a vec but that's a useless structure since ultimately I just want to return
mystring. Is there another way to consume the map that makes sense?
myfuncreturns a string based on the list item and its index, btw.
list.into_iter() .enumerate() .map(|(i,j)| myfunc(i, j)) .collect::<String>()
FromIteratortrait to build the result.
0.5.2for everything to work smoothly.
C = "0.4,0.5,0.6"in B's Cargo.toml
0.4.x, but not
0.5(not 100% sure though)
no matching version `^0.4, ^0.5` found for package versions found: 0.5.2, 0.5.1, 0.5.0, ...
C = '*'though
,requs are anded together... So would
C = 0.6- it fails. If I then make it
C=">=0.4, <=0.6"if fails again.
C = 0.4- it succeeds. If I then make it
C=">=0.4, <=0.6"if succeeds again.
C = 0.4is to modify B's Cargo.toml to have
C = 0.4. Build. And then make it
C = ">=0.4, <=0.6in B's Cargo.toml again
cargo update C --precise "0.4"might be better than manual rewriting
A use C of version 0.5, so in theory Cargo should pick either 0.5 or 0.6...
Box<Any>, but know for sure it's a
Box<Arc<Mutex<GameObjectView>>>, I's suggest you review your interfaces :-)
let bbb = b.borrow(); let bb = bbb.user_data().unwrap().clone(); let gov: Box<Arc<Mutex<GameObjectView>>> = bb.downcast().unwrap(); ^^ cannot move out of borrowed content
as_bytes()is equivalent to preceding &str with
"str".as_bytes() == b"str"
let bbb = b.borrow(); let bb = bbb.user_data().unwrap().clone(); let gov: &Box<Arc<Mutex<GameObjectView>>> = bb.downcast_ref().unwrap();
where gov is
let gov: &Arc<Mutex<GameObjectView>> = bb.downcast_ref().unwrap();
include!, but you probably don't want that...
useone from the other?
main.rs, not only the ones which are used in
yhas the children
mod yin main, and then
::means the root module,
supermeans the parent module
useimplicitly start with
use foo::bar::bazbrings the
bazname into the scope.