Greetings,

(apologies, I'm unsure if the previous message got through, if it did 
please ignore this and reply to the previous email.)

I want to construct a list of list of list of texts.

This is the contract:

@0xf3fc3585f75860e4;

struct ListListListText {
        texts @0 :List(List(List(Text)));
}

This is the mock data:

let mock_commands =
vec![ // a file
    vec![ // lines
        vec![ // pipe symbol contents | |
            vec!["ls1","-l","-a"], // command + arguments
            vec!["ls2","-l","-a"],
        ],
        vec![
            vec!["ls3","-l","-a"],
            vec!["ls4","-l","-a"],
        ],
    ],
    vec![
        vec![
            vec!["ls5","-l","-a"],
            vec!["ls6","-l","-a"],
        ],
        vec![
            vec!["ls7","-l","-a"],
            vec!["ls8","-l","-a"],
        ],
    ],
];

This is the code that fails:

let ip = out_ip.init_root::<list_list_list_text::Builder>();
let mut lines_count: u32 = 0;
for lines in &mock_commands {
    let mut line_count: u32 = 0;
    let ip_lines = ip.init_texts(lines.len() as u32);
    for line in lines {
        let mut pipe_section_count: u32 = 0;
        let ip_line = ip_lines.borrow().set(line_count, 
ip_lines.init_texts(lines.len() as u32));
        for pipe_section in line {
            //let ip_pipe_section = ip_line.init_texts(pipe_section.len() 
as u32);
            for argument in pipe_section {
                //println!("{:?}", argument );
            }
            pipe_section_count += 1;
        }
        line_count += 1;
    }
    lines_count += 1;
}

with:
src/lib.rs:62:41: 62:44 error: no method named `set` found for type 
`capnp::list_list::Builder<'_, 
capnp::list_list::Owned<capnp::text_list::Owned>>` in the current scope
src/lib.rs:62         let ip_line = ip_lines.borrow().set(line_count, 
ip_lines.init_texts(lines.len() as u32));
                                                      ^~~
src/lib.rs:14:1: 125:2 note: in this expansion of component! (defined in 
<rustfbp macros>)
src/lib.rs:62:66: 62:76 error: no method named `init_texts` found for type 
`capnp::list_list::Builder<'_, 
capnp::list_list::Owned<capnp::text_list::Owned>>` in the current scope
src/lib.rs:62         let ip_line = ip_lines.borrow().set(line_count, 
ip_lines.init_texts(lines.len() as u32));
       
The code is obviously wrong, but I want to know what is the correct 
succinct way to initialize list of list of list of texts using Rust?

For example, someone used this technique (in python?): proto.myList = [[1], 
[2,3], [4,5,6]]

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 capnproto+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to