pub struct Configuer<T: for<'de> Model<'de>> {
pub data: T,
/* private fields */
}Fields§
§data: TImplementations§
Source§impl<T: for<'de> Model<'de>> Configuer<T>
impl<T: for<'de> Model<'de>> Configuer<T>
Sourcepub fn with_file(file_name: &str) -> Self
pub fn with_file(file_name: &str) -> Self
Examples found in repository?
examples/main.rs (line 10)
9fn main() {
10 let mut config = Configuer::with_file("myIniFileName").on_create(|| {
11 println!("I see you open this app very first time, please pass your name: ...");
12
13 MyData {
14 user_name: "Default user name".into(),
15 }
16 });
17
18 println!("{:?}", config.data);
19 config.save();
20}Sourcepub fn on_create(self, cb: impl FnOnce() -> T) -> Self
pub fn on_create(self, cb: impl FnOnce() -> T) -> Self
Examples found in repository?
examples/main.rs (lines 10-16)
9fn main() {
10 let mut config = Configuer::with_file("myIniFileName").on_create(|| {
11 println!("I see you open this app very first time, please pass your name: ...");
12
13 MyData {
14 user_name: "Default user name".into(),
15 }
16 });
17
18 println!("{:?}", config.data);
19 config.save();
20}Sourcepub fn save(&mut self) -> &Self
pub fn save(&mut self) -> &Self
Examples found in repository?
examples/main.rs (line 19)
9fn main() {
10 let mut config = Configuer::with_file("myIniFileName").on_create(|| {
11 println!("I see you open this app very first time, please pass your name: ...");
12
13 MyData {
14 user_name: "Default user name".into(),
15 }
16 });
17
18 println!("{:?}", config.data);
19 config.save();
20}Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Configuer<T>where
T: Freeze,
impl<T> RefUnwindSafe for Configuer<T>where
T: RefUnwindSafe,
impl<T> Send for Configuer<T>where
T: Send,
impl<T> Sync for Configuer<T>where
T: Sync,
impl<T> Unpin for Configuer<T>where
T: Unpin,
impl<T> UnwindSafe for Configuer<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more