Okay I think I have it:
the contract:
@0xf61e7fcd2b18d862;
struct List1 {
texts @0 :List(Text);
}
struct List0 {
list @0 :List(List1);
}
struct ListListListText {
list @0 :List(List0);
}
the data:
let mock_commands =
vec![ // all lines in a file
vec![ // line
vec![ // stuff between the pipe symbols | |
vec!["ls1","-l","-a"], // arguments
vec!["ls1","-l","-a"],
],
vec![
vec!["ls1","-l","-a"],
vec!["ls1","-l","-a"],
],
],
vec![
vec![
vec!["ls1","-l","-a"],
vec!["ls1","-l","-a"],
],
vec![
vec!["ls1","-l","-a"],
vec!["ls1","-l","-a"],
],
],
];
the code:
let mut ip = out_ip.init_root::<list_list_list_text::Builder>();
for file in mock_commands {
let mut line_count: u32 = 0;
let mut list_0 = ip.init_list(file.len() as u32);
for line in file {
let mut pipe_count: u32 = 0;
let mut list_1 =
list_0.borrow().get(line_count).init_list(line.len() as u32);
for pipes in line {
let mut argument_count: u32 = 0;
let mut list_of_texts =
list_1.borrow().get(pipe_count).init_texts(pipes.len() as u32);
for argument in pipes {
list_of_texts.borrow().set(argument_count, argument);
argument_count += 1;
}
pipe_count += 1;
}
line_count += 1;
}
}
the error:
src/lib.rs:58:34: 58:36 error: use of moved value: `ip` [E0382]
src/lib.rs:58 let mut list_0 = ip.init_list(file.len() as u32);
^~
src/lib.rs:14:1: 124:2 note: in this expansion of component! (defined
in <rustfbp macros>)
src/lib.rs:58:34: 58:36 help: run `rustc --explain E0382` to see a
detailed explanation
src/lib.rs:58:34: 58:36 note: move occurs because `ip` has type
`contract_capnp::list_list_list_text::Builder<'_>`, which does not
implement the `Copy` trait
How does one add
#[derive(Copy, Clone)]
to contract_capnp::list_list_list_text::Builder<'_'> ?
Help would be most appreciated!
Kind regards
Stewart
--
You received this message because you are subscribed to the Google Groups
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.