Skip to main content

NativeConfig

Struct NativeConfig 

Source
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: u32

The 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: String

What the installed application is called.

§identifier: String

Reverse-DNS. The Windows bundle identity and the Android package name.

§version: String

major.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

Source

pub fn new( product_name: &str, identifier: &str, version: &str, targets: &[&str], ) -> Self

A configuration for a project that has just run init.

Source

pub fn load(path: &Path) -> Result<Self, NativeError>

Read and validate the file at path.

Source

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.

Source

pub fn to_json(&self) -> String

Serialize, formatted the way init writes it.

Source

pub fn validate(&self) -> Result<(), NativeError>

Every rule, checked in one place and before anything expensive runs.

Source

pub fn builds(&self, target: &str) -> bool

Whether target is one this project asked for.

Source

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

Source§

fn clone(&self) -> NativeConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NativeConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for NativeConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for NativeConfig

Source§

impl PartialEq for NativeConfig

Source§

fn eq(&self, other: &NativeConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for NativeConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for NativeConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more