Tuple struct constructor complains about private fields
- by Grubermensch
I am working on a basic shell interpreter to familiarize myself with Rust. While working on the table for storing suspended jobs in the shell, I have gotten stuck at the following compiler error message:
tsh.rs:8:18: 8:31 error: cannot invoke tuple struct constructor with private fields
tsh.rs:8 let mut jobs = job::JobsList(vec![]);
^~~~~~~~~~~~~
It's unclear to me what is being seen as private here. As you can see below, both of the structs are tagged with pub in my module file. So, what's the secret sauce?
tsh.rs
use std::io;
mod job;
fn main() {
// Initialize jobs list
let mut jobs = job::JobsList(vec![]);
loop {
/*** Shell runtime loop ***/
}
}
job.rs
use std::fmt;
pub struct Job {
jid: int,
pid: int,
cmd: String
}
impl fmt::Show for Job {
/*** Formatter ***/
}
pub struct JobsList(Vec<Job>);
impl fmt::Show for JobsList {
/*** Formatter ***/
}