pub trait ImportSettings:
DeserializeOwned
+ Default
+ 'static {
const SECTION: &'static str;
}Expand description
A section of a settings file: a struct the step named SECTION
reads (onebit, indexed), never named after a file format.
A section is a struct with #[serde(default, deny_unknown_fields)]:
every field may be left out, and a typo is an error.
register_import_settings
refuses one without them. Its fields hold integers, bools, enums and
strings, never floats (ADR-0057 §9).
use serde::Deserialize;
use shuyi_assets::import_settings::ImportSettings;
/// How a picture is flipped.
#[derive(Debug, Default, PartialEq, Eq, Deserialize)]
#[serde(default, deny_unknown_fields)]
struct Mirror {
/// Whether it is flipped left to right.
mirror: bool,
}
impl ImportSettings for Mirror {
const SECTION: &'static str = "mirror";
}
let mut formats = shuyi_assets::Formats::standard();
assert!(formats.register_import_settings::<Mirror>().is_ok());Required Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".