-
Heyo! I'm trying to access the course list of 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 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 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I'd rely on auto-complete to show what's accessible in a particular struct, and in lieu of that use the docs.rs documentation of the crate. Since it seems to debug print, I'd assume it's possible to access |
Beta Was this translation helpful? Give feedback.
I'd recommend to look up the docs and see how the type
Option<Vec<Course>>
can be handled. What's probably confusing here is thatOption
also can be iterated, which is why that loop seems to return aVec<Course>
itself, which of course could now be iterated as well.Since this is a Rust question, it's not at all related to this crate as initially suggested.