pub struct Builder { /* private fields */ }Expand description
Collects image configuration and builder-wide PDB acquisition policy.
The default policy has no images, permits online acquisition from Microsoft’s
Symbol Server, and represents the cache as OUT_DIR/pdb-bindgen/cache without
reading OUT_DIR. Offline mode suppresses Symbol Server requests during generation;
it remains valid without a local PDB because the cache may satisfy the request.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn source_root(
&mut self,
path: impl AsRef<Path>,
) -> Result<&mut Self, ConfigError>
pub fn source_root( &mut self, path: impl AsRef<Path>, ) -> Result<&mut Self, ConfigError>
Adds an explicit package-local Rust source root.
Explicit roots replace the default src root and retain insertion order.
Exact duplicate paths are ignored. No filesystem access occurs here.
§Errors
Returns ConfigError::EmptySourceRoot when path is empty.
Sourcepub fn cfg_flag(
&mut self,
name: impl Into<String>,
) -> Result<&mut Self, ConfigError>
pub fn cfg_flag( &mut self, name: impl Into<String>, ) -> Result<&mut Self, ConfigError>
Adds an exact custom cfg flag atom.
§Errors
Returns ConfigError::InvalidCfgName when name is not one Rust cfg
identifier.
Sourcepub fn cfg_value(
&mut self,
name: impl Into<String>,
value: impl Into<String>,
) -> Result<&mut Self, ConfigError>
pub fn cfg_value( &mut self, name: impl Into<String>, value: impl Into<String>, ) -> Result<&mut Self, ConfigError>
Adds an exact custom cfg name-value atom.
Values, including feature values, are retained without normalization.
§Errors
Returns ConfigError::InvalidCfgName when name is not one Rust cfg
identifier.
Sourcepub fn image(&mut self, image: Image) -> Result<&mut Self, ConfigError>
pub fn image(&mut self, image: Image) -> Result<&mut Self, ConfigError>
Adds an image while preserving insertion order.
§Errors
Returns ConfigError::DuplicateImageKey when an existing image has the
same exact source-visible key. The builder is unchanged on error.
Sourcepub fn offline(&mut self, offline: bool) -> &mut Self
pub fn offline(&mut self, offline: bool) -> &mut Self
Enables or disables offline acquisition policy.
Enabling offline mode leaves the configured server visible but instructs generation not to contact it.
Sourcepub fn cache_dir(
&mut self,
path: impl AsRef<Path>,
) -> Result<&mut Self, ConfigError>
pub fn cache_dir( &mut self, path: impl AsRef<Path>, ) -> Result<&mut Self, ConfigError>
Overrides the cache with an explicit directory.
The path is retained without reading or creating it.
§Errors
Returns ConfigError::EmptyCachePath when path is empty.
Sourcepub fn out_dir_cache(&mut self) -> &mut Self
pub fn out_dir_cache(&mut self) -> &mut Self
Restores the unresolved OUT_DIR/pdb-bindgen/cache cache policy.
Sourcepub fn symbol_server(
&mut self,
url: impl Into<String>,
) -> Result<&mut Self, ConfigError>
pub fn symbol_server( &mut self, url: impl Into<String>, ) -> Result<&mut Self, ConfigError>
Overrides the Symbol Server base URL.
Validation deliberately covers only invariants needed by this
configuration layer: an http:// or https:// scheme, a nonempty
authority, and no ASCII whitespace, control characters, query, or fragment.
No network request is made.
§Errors
Returns ConfigError::InvalidSymbolServer when validation fails. The
builder is unchanged on error.
Sourcepub fn microsoft_symbol_server(&mut self) -> &mut Self
pub fn microsoft_symbol_server(&mut self) -> &mut Self
Restores Microsoft’s public Symbol Server.
Sourcepub fn disable_symbol_server(&mut self) -> &mut Self
pub fn disable_symbol_server(&mut self) -> &mut Self
Disables Symbol Server acquisition.
Sourcepub const fn is_offline(&self) -> bool
pub const fn is_offline(&self) -> bool
Returns whether PDB acquisition must avoid network access.
Sourcepub const fn cache_policy(&self) -> &CachePolicy
pub const fn cache_policy(&self) -> &CachePolicy
Returns the configured cache policy.
Sourcepub const fn symbol_server_policy(&self) -> &SymbolServer
pub const fn symbol_server_policy(&self) -> &SymbolServer
Returns the configured Symbol Server policy.
A configured server is not effective while Builder::is_offline is
true.
Sourcepub fn source_roots(&self) -> impl ExactSizeIterator<Item = &Path>
pub fn source_roots(&self) -> impl ExactSizeIterator<Item = &Path>
Returns explicit source roots in insertion order.
An empty iterator means discovery uses the package’s src directory.
Sourcepub fn custom_cfg_flags(&self) -> impl Iterator<Item = &str>
pub fn custom_cfg_flags(&self) -> impl Iterator<Item = &str>
Returns exact custom cfg flags in deterministic order.
Sourcepub fn custom_cfg_values(&self, name: &str) -> impl Iterator<Item = &str>
pub fn custom_cfg_values(&self, name: &str) -> impl Iterator<Item = &str>
Returns exact custom values for one cfg name in deterministic order.
An unknown name produces an empty iterator.
Source§impl Builder
impl Builder
Sourcepub fn generate(&self) -> Result<(), GenerateError>
pub fn generate(&self) -> Result<(), GenerateError>
Discovers active markers, acquires their PDBs, and publishes generated bindings.
This is intended for a Cargo build script. It reads CARGO_MANIFEST_DIR and
OUT_DIR, emits the required Cargo rerun directives, and publishes only after
all active PDBs have been normalized and rendered.
§Errors
Returns a GenerateError when required Cargo environment is unavailable or
when source discovery, PDB acquisition or normalization, binding generation,
Cargo directive emission, or output publication fails. Use
GenerateError::kind and GenerateError::image for structured context.
Trait Implementations§
impl Eq for Builder
impl StructuralPartialEq for Builder
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.