#how do I access struct data within the impl of a struct
5 messages · Page 1 of 1 (latest)
What do you mean by "I tried passing the struct itself but it said it expected value rather than struct"?
Anyway, you probably want to take &mut self as the first argument. If a method takes any form of self as the first argument, it can be called with the foo.method() syntax.
To access self's fields, simply do self.field
so how would that look, as I have a added &mut self however it does not seem to work. I get error[E0423]: expected value, found struct self::AppConfigs ▐
--> src/main.rs:283:65 ▐
| ▐
34 | / struct AppConfigs { ▐
35 | | darkmode: bool, ▐
36 | | language: String, ▐
37 | | recent_reports: String ▐
38 | | } ▐
| |_- self::AppConfigs defined here
from the terminal