pub struct OpaqueTypes { /* private fields */ }Expand description
Builder for generating layout-compatible opaque structs.
See the crate-level documentation for exact parameter formats and workspace setup.
Implementations§
Source§impl OpaqueTypes
impl OpaqueTypes
Sourcepub fn new(source_manifest_dir: impl Into<PathBuf>) -> Self
pub fn new(source_manifest_dir: impl Into<PathBuf>) -> Self
Creates a generator for the package whose Cargo.toml is inside
source_manifest_dir.
Sourcepub fn features<I, S>(self, features: I) -> Self
pub fn features<I, S>(self, features: I) -> Self
Sets explicit, unqualified Cargo feature names for the source dependency.
Each item must match a key in the source package’s [features] table.
This setting is independent of Self::default_features.
Sourcepub fn default_features(self, enabled: bool) -> Self
pub fn default_features(self, enabled: bool) -> Self
Controls whether the source dependency’s default features are enabled.
Defaults to true.
Sourcepub fn add(self, rust_type: Type, opaque_type: Type) -> Self
pub fn add(self, rust_type: Type, opaque_type: Type) -> Self
Adds a source Rust type and its generated opaque struct type.
rust_type must be resolvable from the probe crate. opaque_type must
contain one unqualified Rust identifier.
Sourcepub fn cargo_lock(self, path: impl Into<PathBuf>) -> Self
pub fn cargo_lock(self, path: impl Into<PathBuf>) -> Self
Override the Cargo.lock copied into the probe crate (default: the
destination workspace’s lock, located via
get-cargo-lock).
Sourcepub fn build_dir(self, path: impl Into<PathBuf>) -> Self
pub fn build_dir(self, path: impl Into<PathBuf>) -> Self
Override the probe build directory (default: $OUT_DIR/opaque_probe).
Sourcepub fn generate(&self, destination: impl AsRef<Path>) -> Result<()>
pub fn generate(&self, destination: impl AsRef<Path>) -> Result<()>
Probes every requested type and writes the generated Rust source to
destination.
The destination is written only after every requested type’s size and alignment has been read successfully. Failure to build or inspect any requested type returns an error and leaves an existing destination file unchanged.
Trait Implementations§
Source§impl Clone for OpaqueTypes
impl Clone for OpaqueTypes
Source§fn clone(&self) -> OpaqueTypes
fn clone(&self) -> OpaqueTypes
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more