Function nibi::app::fsio::write_string

source ·
pub fn write_string(file: File, string: String) -> Result<File, Error>
Examples found in repository?
src/app/config.rs (line 119)
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
pub fn create_config_file(config_path: &Path, config: &Config) -> Result<File, IOError> {
	match new_empty_file(config_path) {
		Ok(target_file) => {
			let serialized_config = config.to_ron(None);
			write_string(target_file, serialized_config)
		}
		err => {
			return err;
		}
	}
}

pub fn reset_config_file(config_path: &Path, config: &Config) -> Result<File, IOError> {
	match open_file_with_overwrite_mode(config_path) {
		Ok(target_file) => {
			let serialized_config = config.to_ron(None);
			write_string(target_file, serialized_config)
		}
		err => {
			return err;
		}
	}
}