Unable to access elements of ListCoursesResponse
pmnlla opened this issue · 0 comments
pmnlla commented
Heyo! I'm trying to access the course list of hub.courses().list().doit().await;
where I assume that each course is a separate Course
struct, through the following piece of code:
match req {
Err(e) => print!("{}",e),
Ok(output) => courseListParse(output.1, clist),
}
// outside of function...
fn courseListParse(mut response:ListCoursesResponse, mut clist:Vec<class::classType>){
for i in &response.courses{
println!("{:?}\n", i); // this print statement is a placeholder so i can view the data returned by the gclassroom api, and later aggregate it
}
}
however, i am running into an issue where the data returned by response.courses
is a single element, probably a vector of classes. I cannot access any elements of this vector through this current function.
I'm quite new to rust, so if I'm making any obvious mistake, please let me know. I did look over rustdoc and found out that the courses
variable in ListCoursesResponse
is a vector of Course
s, which I think would typically be accessible through response.courses.[0-x]
as per a typical vector.