Struct cargo_packager::config::Config

source ·
pub struct Config {
Show 31 fields pub product_name: String, pub version: String, pub binaries: Vec<Binary>, pub identifier: Option<String>, pub before_packaging_command: Option<HookCommand>, pub before_each_package_command: Option<HookCommand>, pub log_level: Option<LogLevel>, pub formats: Option<Vec<PackageFormat>>, pub out_dir: PathBuf, pub binaries_dir: Option<PathBuf>, pub target_triple: Option<String>, pub description: Option<String>, pub long_description: Option<String>, pub homepage: Option<String>, pub authors: Option<Vec<String>>, pub publisher: Option<String>, pub license_file: Option<PathBuf>, pub copyright: Option<String>, pub category: Option<AppCategory>, pub icons: Option<Vec<String>>, pub file_associations: Option<Vec<FileAssociation>>, pub resources: Option<Vec<Resource>>, pub external_binaries: Option<Vec<PathBuf>>, pub windows: Option<WindowsConfig>, pub macos: Option<MacOsConfig>, pub deb: Option<DebianConfig>, pub appimage: Option<AppImageConfig>, pub pacman: Option<PacmanConfig>, pub wix: Option<WixConfig>, pub nsis: Option<NsisConfig>, pub dmg: Option<DmgConfig>, /* private fields */
}
Expand description

The packaging config.

Fields§

§product_name: String

The package’s product name, for example “My Awesome App”.

§version: String

The package’s version.

§binaries: Vec<Binary>

The binaries to package.

§identifier: Option<String>

The application identifier in reverse domain name notation (e.g. com.packager.example). This string must be unique across applications since it is used in some system configurations. This string must contain only alphanumeric characters (A–Z, a–z, and 0–9), hyphens (-), and periods (.).

§before_packaging_command: Option<HookCommand>

The command to run before starting to package an application.

This runs only once.

§before_each_package_command: Option<HookCommand>

The command to run before packaging each format for an application.

This will run multiple times depending on the formats specifed.

§log_level: Option<LogLevel>

The logging level.

§formats: Option<Vec<PackageFormat>>

The packaging formats to create, if not present, PackageFormat::platform_default is used.

§out_dir: PathBuf

The directory where the generated packages will be placed.

If Config::binaries_dir is not set, this is also where the Config::binaries exist.

§binaries_dir: Option<PathBuf>

The directory where the Config::binaries exist.

Defaults to Config::out_dir.

§target_triple: Option<String>

The target triple we are packaging for. This mainly affects Config::external_binaries.

Defaults to the current OS target triple.

§description: Option<String>

The package’s description.

§long_description: Option<String>

The app’s long description.

§homepage: Option<String>

The package’s homepage.

§authors: Option<Vec<String>>

The package’s authors.

§publisher: Option<String>

The app’s publisher. Defaults to the second element in Config::identifier string. Currently maps to the Manufacturer property of the Windows Installer.

§license_file: Option<PathBuf>

A path to the license file.

§copyright: Option<String>

The app’s copyright.

§category: Option<AppCategory>

The app’s category.

§icons: Option<Vec<String>>

The app’s icon list. Supports glob patterns.

§file_associations: Option<Vec<FileAssociation>>

The file associations

§resources: Option<Vec<Resource>>

The app’s resources to package. This a list of either a glob pattern, path to a file, path to a directory or an object of src and target paths. In the case of using an object, the src could be either a glob pattern, path to a file, path to a directory, and the target is a path inside the final resources folder in the installed package.

§Format-specific:

§external_binaries: Option<Vec<PathBuf>>

Paths to external binaries to add to the package.

The path specified should not include -<target-triple><.exe> suffix, it will be auto-added when by the packager when reading these paths, so the actual binary name should have the target platform’s target triple appended, as well as .exe for Windows.

For example, if you’re packaging an external binary called sqlite3, the packager expects a binary named sqlite3-x86_64-unknown-linux-gnu on linux, and sqlite3-x86_64-pc-windows-gnu.exe on windows.

If you are building a universal binary for MacOS, the packager expects your external binary to also be universal, and named after the target triple, e.g. sqlite3-universal-apple-darwin. See https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary

§windows: Option<WindowsConfig>

Windows-specific configuration.

§macos: Option<MacOsConfig>

MacOS-specific configuration.

§deb: Option<DebianConfig>

Debian-specific configuration.

§appimage: Option<AppImageConfig>

AppImage configuration.

§pacman: Option<PacmanConfig>

Pacman configuration.

§wix: Option<WixConfig>

WiX configuration.

§nsis: Option<NsisConfig>

Nsis configuration.

§dmg: Option<DmgConfig>

Dmg configuration.

Implementations§

source§

impl Config

source

pub fn builder() -> ConfigBuilder

Creates a new ConfigBuilder.

source

pub fn windows(&self) -> Option<&WindowsConfig>

Returns the windows specific configuration.

source

pub fn macos(&self) -> Option<&MacOsConfig>

Returns the macos specific configuration.

source

pub fn nsis(&self) -> Option<&NsisConfig>

Returns the nsis specific configuration.

source

pub fn wix(&self) -> Option<&WixConfig>

Returns the wix specific configuration.

source

pub fn deb(&self) -> Option<&DebianConfig>

Returns the debian specific configuration.

source

pub fn appimage(&self) -> Option<&AppImageConfig>

Returns the appimage specific configuration.

source

pub fn pacman(&self) -> Option<&PacmanConfig>

Returns the pacman specific configuration.

source

pub fn dmg(&self) -> Option<&DmgConfig>

Returns the dmg specific configuration.

source

pub fn target_triple(&self) -> String

Returns the target triple of this config, if not set, fallsback to the current OS target triple.

source

pub fn target_arch(&self) -> Result<&str>

Returns the architecture for the package to be built (e.g. “arm”, “x86” or “x86_64”).

source

pub fn binary_path(&self, binary: &Binary) -> PathBuf

Returns the path to the specified binary.

source

pub fn identifier(&self) -> &str

Returns the package identifier. Defaults an empty string.

source

pub fn publisher(&self) -> String

Returns the package publisher. Defaults to the second element in Config::identifier.

source

pub fn out_dir(&self) -> PathBuf

Returns the out dir. Defaults to the current directory.

source

pub fn binaries_dir(&self) -> PathBuf

Returns the binaries dir. Defaults to Self::out_dir if Self::binaries_dir is not set.

source

pub fn main_binary(&self) -> Result<&Binary>

Returns the main binary.

source

pub fn main_binary_name(&self) -> Result<String>

Returns the main binary name.

source

pub fn icons(&self) -> Result<Option<Vec<PathBuf>>>

Returns all icons path.

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Config

source§

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

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

impl Default for Config

source§

fn default() -> Config

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Config

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 Serialize for Config

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

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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
source§

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