Skip to main content

OpaqueTypes

Struct OpaqueTypes 

Source
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

Source

pub fn new(source_manifest_dir: impl Into<PathBuf>) -> Self

Creates a generator for the package whose Cargo.toml is inside source_manifest_dir.

Source

pub fn features<I, S>(self, features: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

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.

Source

pub fn default_features(self, enabled: bool) -> Self

Controls whether the source dependency’s default features are enabled. Defaults to true.

Source

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.

Source

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

Source

pub fn build_dir(self, path: impl Into<PathBuf>) -> Self

Override the probe build directory (default: $OUT_DIR/opaque_probe).

Source

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

Source§

fn clone(&self) -> OpaqueTypes

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 OpaqueTypes

Source§

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

Formats the value using the given formatter. Read more

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

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.