pub struct Config { /* private fields */ }
Implementations§
source§impl Config
impl Config
pub fn new(project_name: String, site_name: String) -> Self
pub fn project_name<T: Into<String>>(self, proj_name: T) -> Self
pub fn site_title<T: Into<String>>(self, site_name: T) -> Self
sourcepub fn to_ron(&self, pretty_config: Option<PrettyConfig>) -> String
pub fn to_ron(&self, pretty_config: Option<PrettyConfig>) -> String
Examples found in repository?
src/app/config.rs (line 118)
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;
}
}
}
pub fn from_ron(ron_str: &str) -> SpannedResult<Self>
pub fn from_ron_file(file: File) -> SpannedResult<Config>
sourcepub fn get_dir_conf(&self) -> &DirConf
pub fn get_dir_conf(&self) -> &DirConf
Examples found in repository?
src/cmd/init.rs (line 154)
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
fn create_src_dirs(config: &Config, root_dir: &Path) -> bool {
match config.get_dir_conf().create_src_dirs(root_dir) {
Err(errs) => {
for e in errs {
println!(
"ディレクトリ {} の作成中にエラーが発生しました: {}",
e.1.display(),
e.0
);
}
false
}
_ => true,
}
}
Trait Implementations§
source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more