Is there any way to pass new Struct with new Trait?

mod one {
  pub struct Ctx {
    username:String,
    password: String
  }
}

mod two {
  pub trail Get;
  impl Get for Ctx {
    fn get (&self) -> Ctx {
      Ctx {
        username: self.username,
        password : self.password
      }
    }
  }
}

mod three {
  println!(Ctx.get());
}

Every mod is in the different mod file. Once I add new trait it should reflect to mod there.
I think it is not possible but still asking. Is there any way?

You need to import the trait you are using into the module where you are calling it from.

1 Like

Man you are awesome :heart_eyes:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.