2014-11-05 17:05:01 -06:00
|
|
|
struct Mine{
|
|
|
|
test: String,
|
2015-01-08 04:54:35 -06:00
|
|
|
other_val: isize
|
2014-11-05 17:05:01 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Mine{
|
|
|
|
fn make_string_bar(mut self) -> Mine{
|
|
|
|
self.test = "Bar".to_string();
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main(){
|
|
|
|
let start = Mine{test:"Foo".to_string(), other_val:0};
|
|
|
|
let end = Mine{other_val:1, ..start.make_string_bar()};
|
2019-04-22 02:40:08 -05:00
|
|
|
println!("{}", start.test); //~ ERROR borrow of moved value: `start`
|
2014-11-05 17:05:01 -06:00
|
|
|
}
|