pub struct NativeConfig {Show 14 fields
pub schema_ref: Option<String>,
pub schema: u32,
pub product_name: String,
pub identifier: String,
pub version: String,
pub targets: Vec<String>,
pub window: WindowConfig,
pub android: AndroidConfig,
pub bundle: BundleConfig,
pub database: DatabaseConfig,
pub auth: AuthConfig,
pub local: Option<String>,
pub security: SecurityConfig,
pub scaffold: BTreeMap<String, String>,
}Expand description
A project’s native packaging configuration.
Fields§
§schema_ref: Option<String>Editor support. Written by init, ignored on read.
schema: u32The format version. Refused rather than guessed at when it is not one this build knows: a field that changed meaning is worse than a file that will not load.
product_name: StringWhat the installed application is called.
identifier: StringReverse-DNS. The Windows bundle identity and the Android package name.
version: Stringmajor.minor.patch. Numeric because both platforms require it.
targets: Vec<String>Which packages this project builds.
window: WindowConfig§android: AndroidConfig§bundle: BundleConfig§database: DatabaseConfig§auth: AuthConfig§local: Option<String>Depend on a Rahti checkout by path rather than by version.
For working on the framework itself, and the same idea as
cargo rahti new --local. Recorded rather than passed each time
because native/Cargo.toml is regenerated from this file, and a run
that forgot the flag would quietly move the shell onto a published
version of a crate that is being changed locally.
The path is relative to the project root, or absolute.
security: SecurityConfig§scaffold: BTreeMap<String, String>Content hashes of the generated files under native/, written by
cargo rahti native init.
How a later run knows which of them you have edited — and therefore which it must leave alone. Bookkeeping rather than configuration: it is in this file because this file is already the one a project commits, and a second file holding nine hashes would be a second file.
Empty is not written out, so a hand-written configuration does not grow a section it never asked for.
Implementations§
Source§impl NativeConfig
impl NativeConfig
Sourcepub fn new(
product_name: &str,
identifier: &str,
version: &str,
targets: &[&str],
) -> Self
pub fn new( product_name: &str, identifier: &str, version: &str, targets: &[&str], ) -> Self
A configuration for a project that has just run init.
Sourcepub fn load(path: &Path) -> Result<Self, NativeError>
pub fn load(path: &Path) -> Result<Self, NativeError>
Read and validate the file at path.
Sourcepub fn parse(text: &str) -> Result<Self, NativeError>
pub fn parse(text: &str) -> Result<Self, NativeError>
Parse, migrate, and validate, without a file.
Migration comes before validation on purpose. A stored value this build
would now write differently is corrected here, so every caller — init,
doctor, build — sees the corrected configuration, and a project
created by an older Rahti is not refused by a rule that did not exist
when its file was written. See superseded_csp.
Sourcepub fn validate(&self) -> Result<(), NativeError>
pub fn validate(&self) -> Result<(), NativeError>
Every rule, checked in one place and before anything expensive runs.
Sourcepub fn android_version_code(&self) -> u32
pub fn android_version_code(&self) -> u32
The integer Google Play orders releases by.
Derived rather than stored, so there is one version in the file and no
way for the two to disagree. 1.2.3 becomes 10203, which increases
with the version for any patch or minor below 100.
Trait Implementations§
Source§impl Clone for NativeConfig
impl Clone for NativeConfig
Source§fn clone(&self) -> NativeConfig
fn clone(&self) -> NativeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more