Accessing struct inside mod

im very new to rustlang and i can't figure out this private errors come from.

pub mod media {

    pub struct AudioDevice {
        rec_id: i16,
        play_id: i16,

    pub fn audio_device() -> AudioDevice {
        AudioDevice {
            rec_id: -1,
            play_id: -1,


struct Card {
    record_id: i16,
    play_id: i16,

fn card() -> Card {
    Card {
        record_id: 1,
        play_id: 1,

fn main() {
    use media::AudioDevice; 
    let _sample: AudioDevice = crate::media::audio_device();
    let _card = card();
    println!("record_id: {}, play_id: {}", _card.record_id, _card.play_id); // --> this OK
    println!("map rec_id: {}, play_id: {} ", _sample.play_id, _sample.rec_id); // error with private

For context - this question was also posted here (so that we don't duplicate the efforts on accident).

yes it posted at stackoverflow,
and thx for having me in rust community.

For context, it was answered on the previously linked SO post

it's okay. sorry for my late reply

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.