pub struct Builder { /* private fields */ }Implementations§
Source§impl Builder
impl Builder
Sourcepub fn with_config(config: Config) -> Self
pub fn with_config(config: Config) -> Self
Creates a config file builder based on a Config.
Examples found in repository?
More examples
examples/own_set_components.rs (lines 8-12)
6fn main() {
7 let components: &[Components] = &[Components::Provider, Components::PlayerId];
8 let mut config_builder = Builder::with_config(Config {
9 name: String::from("my_gsi_config_file"),
10 data: Data::from(components),
11 ..Default::default()
12 });
13 config_builder
14 .build()
15 .install("C:\\Counter-Strike Global Offensive\\csgo\\cfg")
16 .unwrap();
17}Sourcepub fn build(&mut self) -> &mut Self
pub fn build(&mut self) -> &mut Self
Serializes the Config to a string ready to be written in a cfg file.
Examples found in repository?
More examples
examples/own_set_components.rs (line 14)
6fn main() {
7 let components: &[Components] = &[Components::Provider, Components::PlayerId];
8 let mut config_builder = Builder::with_config(Config {
9 name: String::from("my_gsi_config_file"),
10 data: Data::from(components),
11 ..Default::default()
12 });
13 config_builder
14 .build()
15 .install("C:\\Counter-Strike Global Offensive\\csgo\\cfg")
16 .unwrap();
17}Sourcepub fn output(&self) -> String
pub fn output(&self) -> String
Gets the serialized Config.
This method must only be called after build.
Sourcepub fn install<P: Into<PathBuf>>(
&self,
folder_path: P,
) -> Result<(), Box<dyn Error>>
pub fn install<P: Into<PathBuf>>( &self, folder_path: P, ) -> Result<(), Box<dyn Error>>
Write the serialized Config to a cfg file at the path passed in
argument.
Examples found in repository?
More examples
examples/own_set_components.rs (line 15)
6fn main() {
7 let components: &[Components] = &[Components::Provider, Components::PlayerId];
8 let mut config_builder = Builder::with_config(Config {
9 name: String::from("my_gsi_config_file"),
10 data: Data::from(components),
11 ..Default::default()
12 });
13 config_builder
14 .build()
15 .install("C:\\Counter-Strike Global Offensive\\csgo\\cfg")
16 .unwrap();
17}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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