Struct wdk_build::Config

source ·
pub struct Config {
    pub wdk_content_root: PathBuf,
    pub driver_config: DriverConfig,
    pub cpu_architecture: CPUArchitecture,
}
Expand description

Configuration parameters for a build dependent on the WDK

Fields§

§wdk_content_root: PathBuf

Path to root of WDK. Corresponds with WDKContentRoot environment varialbe in eWDK

§driver_config: DriverConfig

Build configuration of driver

§cpu_architecture: CPUArchitecture

CPU architecture to target

Implementations§

source§

impl Config

source

pub fn new() -> Self

Creates a new Config with default values

source

pub fn from_env<S: AsRef<str> + Display>( links_value: S ) -> Result<Self, ConfigFromEnvError>

Creates a Config from a config exported from a dependency. The dependency must have exported a Config via Config::export_config, and the dependency must have set a links value in its Cargo manifiest to export the DEP_<CARGO_MANIFEST_LINKS>_WDK_CONFIG to downstream crates

§Errors

This function will return an error if the provided links_value does not correspond with a links value specified in the Cargo manifest of one of the dependencies of the crate who’s build script invoked this function.

source

pub fn from_env_auto() -> Result<Self, ConfigFromEnvError>

Creates a Config from a config exported from wdk or wdk_sys crates.

§Errors

This function will return an error if: * an exported config from a dependency on wdk and/or wdk_sys cannot be found * there is a config mismatch between wdk and wdk_sys

source

pub fn get_include_paths(&self) -> Result<Vec<PathBuf>, ConfigError>

Returns header include paths required to build and link based off of the configuration of Config

§Errors

This function will return an error if any of the required paths do not exist.

source

pub fn get_library_paths(&self) -> Result<Vec<PathBuf>, ConfigError>

Returns library include paths required to build and link based off of the configuration of Config

§Errors

This function will return an error if any of the required paths do not exist.

source

pub fn configure_library_build(&self) -> Result<(), ConfigError>

Configures a Cargo build of a library that directly depends on the WDK (i.e. not transitively via wdk-sys). This emits specially formatted prints to Cargo based on this Config.

This includes header include paths, linker search paths, library link directives, and WDK-specific configuration definitions. This must be called from a Cargo build script of the library.

§Errors

This function will return an error if any of the required paths do not exist.

§Panics

Panics if the invoked from outside a Cargo build environment

source

pub fn configure_binary_build(&self)

Configures a Cargo build of a binary that depends on the WDK. This emits specially formatted prints to Cargo based on this Config.

This consists mainly of linker setting configuration. This must be called from a Cargo build script of the binary being built

source

pub fn export_config(&self) -> Result<(), ExportError>

Serializes this Config and exports it via the Cargo DEP_<CARGO_MANIFEST_LINKS>_WDK_CONFIG environment variable.

§Errors

This function will return an error if the crate does not have a links field in its Cargo manifest or if it fails to serialize the config.

§Panics

Panics if this Config fails to serialize.

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() -> Self

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

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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
source§

impl Eq for Config

source§

impl StructuralPartialEq for Config

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

source§

fn from(t: T) -> T

Returns the argument unchanged.

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,

§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,