Struct rhdxmr_publish_test_lib::bindgen::Builder [−][src]
pub struct Builder { /* fields omitted */ }
Expand description
Configure and generate Rust bindings for a C/C++ header.
This is the main entry point to the library.
use bindgen::builder;
// Configure and generate bindings.
let bindings = builder().header("path/to/input/header")
.allowlist_type("SomeCoolClass")
.allowlist_function("do_some_cool_thing")
.generate()?;
// Write the generated bindings to an output file.
bindings.write_to_file("path/to/output.rs")?;
Enums
Bindgen can map C/C++ enums into Rust in different ways. The way bindgen maps enums depends on the pattern passed to several methods:
For each C enum, bindgen tries to match the pattern in the following order:
- Constified enum module
- Bitfield enum
- Newtype enum
- Rustified enum
If none of the above patterns match, then bindgen will generate a set of Rust constants.
Clang arguments
Extra arguments can be passed to with clang:
clang_arg()
: takes a single argumentclang_args()
: takes an iterator of argumentsBINDGEN_EXTRA_CLANG_ARGS
environment variable: whitespace separate environment variable of arguments
Clang arguments specific to your crate should be added via the
clang_arg()
/clang_args()
methods.
End-users of the crate may need to set the BINDGEN_EXTRA_CLANG_ARGS
environment variable to
add additional arguments. For example, to build against a different sysroot a user could set
BINDGEN_EXTRA_CLANG_ARGS
to --sysroot=/path/to/sysroot
.
Implementations
Generates the command line flags use for creating Builder
.
Add an input C/C++ header to generate bindings for.
This can be used to generate bindings to a single header:
let bindings = bindgen::Builder::default()
.header("input.h")
.generate()
.unwrap();
Or you can invoke it multiple times to generate bindings to multiple headers:
let bindings = bindgen::Builder::default()
.header("first.h")
.header("second.h")
.header("third.h")
.generate()
.unwrap();
Add a depfile output which will be written alongside the generated bindings.
Add contents
as an input C/C++ header named name
.
The file name
will be added to the clang arguments.
Specify the rust target
The default is the latest stable Rust version
Disable support for native Rust unions, if supported.
Disable insertion of bindgen’s version identifier into generated bindings.
Set the output graphviz file.
Whether the generated bindings should contain documentation comments (docstrings) or not. This is set to true by default.
Note that clang by default excludes comments from system headers, pass
-fretain-comments-from-system-headers
as
clang_arg
to include them. It can also be told
to process all comments (not just documentation ones) using the
-fparse-all-comments
flag. See slides on clang comment parsing for
background and examples.
Whether to allowlist recursively or not. Defaults to true.
Given that we have explicitly allowlisted the “initiate_dance_party” function in this C header:
typedef struct MoonBoots {
int bouncy_level;
} MoonBoots;
void initiate_dance_party(MoonBoots* boots);
We would normally generate bindings to both the initiate_dance_party
function and the MoonBoots
struct that it transitively references. By
configuring with allowlist_recursively(false)
, bindgen
will not emit
bindings for anything except the explicitly allowlisted items, and there
would be no emitted struct definition for MoonBoots
. However, the
initiate_dance_party
function would still reference MoonBoots
!
Disabling this feature will almost certainly cause bindgen
to emit
bindings that will not compile! If you disable this feature, then it
is your responsibility to provide definitions for every type that is
referenced from an explicitly allowlisted item. One way to provide the
definitions is by using the Builder::raw_line
method, another would be to define them in Rust and then include!(...)
the bindings immediately afterwards.
👎 Deprecated: Use allowlist_recursively instead
Use allowlist_recursively instead
Deprecated alias for allowlist_recursively.
Generate #[macro_use] extern crate objc;
instead of use objc;
in the prologue of the files generated from objective-c files
Generate proper block signatures instead of void pointers.
Generate #[macro_use] extern crate block;
instead of use block;
in the prologue of the files generated from apple block files
Whether to use the clang-provided name mangling. This is true by default and probably needed for C++ features.
However, some old libclang versions seem to return incorrect results in some cases for non-mangled functions, see 1, so we allow disabling it.
👎 Deprecated: Use blocklist_type instead
Use blocklist_type instead
Hide the given type from the generated bindings. Regular expressions are supported.
👎 Deprecated: Use blocklist_type instead
Use blocklist_type instead
Hide the given type from the generated bindings. Regular expressions are supported.
Hide the given type from the generated bindings. Regular expressions are supported.
To blocklist types prefixed with “mylib” use "mylib_.*"
.
For more complicated expressions check
regex docs
👎 Deprecated: Use blocklist_function instead
Use blocklist_function instead
Hide the given function from the generated bindings. Regular expressions are supported.
Hide the given function from the generated bindings. Regular expressions are supported.
To blocklist functions prefixed with “mylib” use "mylib_.*"
.
For more complicated expressions check
regex docs
👎 Deprecated: Use blocklist_item instead
Use blocklist_item instead
Hide the given item from the generated bindings, regardless of whether it’s a type, function, module, etc. Regular expressions are supported.
Hide the given item from the generated bindings, regardless of whether it’s a type, function, module, etc. Regular expressions are supported.
To blocklist items prefixed with “mylib” use "mylib_.*"
.
For more complicated expressions check
regex docs
Treat the given type as opaque in the generated bindings. Regular expressions are supported.
To change types prefixed with “mylib” into opaque, use "mylib_.*"
.
For more complicated expressions check
regex docs
👎 Deprecated: use allowlist_type instead
use allowlist_type instead
Allowlist the given type so that it (and all types that it transitively refers to) appears in the generated bindings. Regular expressions are supported.
👎 Deprecated: use allowlist_type instead
use allowlist_type instead
Allowlist the given type so that it (and all types that it transitively refers to) appears in the generated bindings. Regular expressions are supported.
Allowlist the given type so that it (and all types that it transitively refers to) appears in the generated bindings. Regular expressions are supported.
To allowlist types prefixed with “mylib” use "mylib_.*"
.
For more complicated expressions check
regex docs
Allowlist the given function so that it (and all types that it transitively refers to) appears in the generated bindings. Regular expressions are supported.
To allowlist functions prefixed with “mylib” use "mylib_.*"
.
For more complicated expressions check
regex docs
👎 Deprecated: use allowlist_function instead
use allowlist_function instead
Allowlist the given function.
Deprecated: use allowlist_function instead.
👎 Deprecated: use allowlist_function instead
use allowlist_function instead
Allowlist the given function.
Deprecated: use allowlist_function instead.
Allowlist the given variable so that it (and all types that it transitively refers to) appears in the generated bindings. Regular expressions are supported.
To allowlist variables prefixed with “mylib” use "mylib_.*"
.
For more complicated expressions check
regex docs
👎 Deprecated: use allowlist_var instead
use allowlist_var instead
Deprecated: use allowlist_var instead.
👎 Deprecated: use allowlist_var instead
use allowlist_var instead
Allowlist the given variable.
Deprecated: use allowlist_var instead.
Set the default style of code to generate for enums
Mark the given enum (or set of enums, if using a pattern) as being bitfield-like. Regular expressions are supported.
This makes bindgen generate a type that isn’t a rust enum
. Regular
expressions are supported.
This is similar to the newtype enum style, but with the bitwise operators implemented.
Mark the given enum (or set of enums, if using a pattern) as a newtype. Regular expressions are supported.
This makes bindgen generate a type that isn’t a Rust enum
. Regular
expressions are supported.
Mark the given enum (or set of enums, if using a pattern) as a Rust enum.
This makes bindgen generate enums instead of constants. Regular expressions are supported.
Use this with caution, creating this in unsafe code (including FFI) with an invalid value will invoke undefined behaviour. You may want to use the newtype enum style instead.
Mark the given enum (or set of enums, if using a pattern) as a Rust
enum with the #[non_exhaustive]
attribute.
This makes bindgen generate enums instead of constants. Regular expressions are supported.
Use this with caution, creating this in unsafe code (including FFI) with an invalid value will invoke undefined behaviour. You may want to use the newtype enum style instead.
Mark the given enum (or set of enums, if using a pattern) as a set of constants that are not to be put into a module.
Mark the given enum (or set of enums, if using a pattern) as a set of constants that should be put into a module.
This makes bindgen generate modules containing constants instead of just constants. Regular expressions are supported.
Set the default type for macro constants
Set the default style of code to generate for typedefs
Mark the given typedef alias (or set of aliases, if using a pattern) to use regular Rust type aliasing.
This is the default behavior and should be used if default_alias_style
was set to NewType or NewTypeDeref and you want to override it for a
set of typedefs.
Mark the given typedef alias (or set of aliases, if using a pattern) to be generated as a new type by having the aliased type be wrapped in a #[repr(transparent)] struct.
Used to enforce stricter type checking.
Mark the given typedef alias (or set of aliases, if using a pattern) to
be generated as a new type by having the aliased type be wrapped in a
#[repr(transparent)] struct and also have an automatically generated
impl’s of Deref
and DerefMut
to their aliased type.
Add a string to prepend to the generated bindings. The string is passed through without any modification.
Add a given line to the beginning of module mod
.
pub fn module_raw_lines<T, I>(self, mod_: T, lines: I) -> Builder where
T: Into<String>,
I: IntoIterator,
<I as IntoIterator>::Item: Into<String>,
pub fn module_raw_lines<T, I>(self, mod_: T, lines: I) -> Builder where
T: Into<String>,
I: IntoIterator,
<I as IntoIterator>::Item: Into<String>,
Add a given set of lines to the beginning of module mod
.
Add an argument to be passed straight through to clang.
pub fn clang_args<I>(self, iter: I) -> Builder where
I: IntoIterator,
<I as IntoIterator>::Item: AsRef<str>,
pub fn clang_args<I>(self, iter: I) -> Builder where
I: IntoIterator,
<I as IntoIterator>::Item: AsRef<str>,
Add arguments to be passed straight through to clang.
Emit bindings for builtin definitions (for example __builtin_va_list
)
in the generated Rust.
Avoid converting floats to f32
/f64
by default.
Set whether layout tests should be generated.
Set whether Debug
should be implemented, if it can not be derived automatically.
Set whether PartialEq
should be implemented, if it can not be derived automatically.
Set whether Copy
should be derived by default.
Set whether Debug
should be derived by default.
Set whether Default
should be derived by default.
Set whether Hash
should be derived by default.
Set whether PartialOrd
should be derived by default.
If we don’t compute partialord, we also cannot compute
ord. Set the derive_ord to false
when doit is false
.
Set whether Ord
should be derived by default.
We can’t compute Ord
without computing PartialOrd
,
so we set the same option to derive_partialord.
Set whether PartialEq
should be derived by default.
If we don’t derive PartialEq
, we also cannot derive Eq
, so deriving
Eq
is also disabled when doit
is false
.
Set whether Eq
should be derived by default.
We can’t derive Eq
without also deriving PartialEq
, so we also
enable deriving PartialEq
when doit
is true
.
Set whether or not to time bindgen phases, and print information to stderr.
Emit Clang AST.
Enable C++ namespaces.
Enable detecting must_use attributes on C functions.
This is quite slow in some cases (see #1465), so it’s disabled by default.
Note that for this to do something meaningful for now at least, the rust
target version has to have support for #[must_use]
.
Disable name auto-namespacing.
By default, bindgen mangles names like foo::bar::Baz
to look like
foo_bar_Baz
instead of just Baz
.
This method disables that behavior.
Note that this intentionally does not change the names used for allowlisting and blocklisting, which should still be mangled with the namespaces.
Note, also, that this option may cause bindgen to generate duplicate names.
Disable nested struct naming.
The following structs have different names for C and C++. In case of C
they are visible as foo
and bar
. In case of C++ they are visible as
foo
and foo::bar
.
struct foo {
struct bar {
} b;
};
Bindgen wants to avoid duplicate names by default so it follows C++ naming
and it generates foo
/foo_bar
instead of just foo
/bar
.
This method disables this behavior and it is indented to be used only for headers that were written for C.
Treat inline namespaces conservatively.
This is tricky, because in C++ is technically legal to override an item defined in an inline namespace:
inline namespace foo {
using Bar = int;
}
using Bar = long;
Even though referencing Bar
is a compiler error.
We want to support this (arguably esoteric) use case, but we don’t want to make the rest of bindgen users pay an usability penalty for that.
To support this, we need to keep all the inline namespaces around, but
then bindgen usage is a bit more difficult, because you cannot
reference, e.g., std::string
(you’d need to use the proper inline
namespace).
We could complicate a lot of the logic to detect name collisions, and if
not detected generate a pub use inline_ns::*
or something like that.
That’s probably something we can do if we see this option is needed in a lot of cases, to improve it’s usability, but my guess is that this is not going to be too useful.
Whether inline functions should be generated or not.
Note that they will usually not work. However you can use
-fkeep-inline-functions
or -fno-inline-functions
if you are
responsible of compiling the library to make them callable.
Ignore functions.
Ignore methods.
👎 Deprecated: please use rust_target
instead
please use rust_target
instead
Avoid generating any unstable Rust, such as Rust unions, in the generated bindings.
Use the given prefix for the raw types instead of ::std::os::raw
.
Use the given prefix for the anon fields.
Allows configuring types in different situations, see the
ParseCallbacks
documentation.
Choose what to generate using a
CodegenConfig
.
Whether to detect include paths using clang_sys.
Whether to try to fit macro constants to types smaller than u32/i32
Prepend the enum name to constant or newtype variants.
Set whether size_t
should be translated to usize
automatically.
Set whether rustfmt should format the generated bindings.
Set whether we should record matched items in our regex sets.
Set the absolute path to the rustfmt configuration file, if None, the standard rustfmt options are used.
Sets an explicit path to rustfmt, to be used when rustfmt is enabled.
If true, always emit explicit padding fields.
If a struct needs to be serialized in its native format (padding bytes and all), for example writing it to a file or sending it on the network, then this should be enabled, as anything reading the padding bytes of a struct may lead to Undefined Behavior.
Generate the Rust bindings using the options built up thus far.
Preprocess and dump the input header files to disk.
This is useful when debugging bindgen, using C-Reduce, or when filing
issues. The resulting file will be named something like __bindgen.i
or
__bindgen.ii
Don’t derive PartialEq
for a given type. Regular
expressions are supported.
Don’t derive Copy
for a given type. Regular
expressions are supported.
Don’t derive Debug
for a given type. Regular
expressions are supported.
Don’t derive/impl Default
for a given type. Regular
expressions are supported.
Don’t derive Hash
for a given type. Regular
expressions are supported.
Set whether arr[size]
should be treated as *mut T
or *mut [T; size]
(same for mut)
Set the wasm import module name
pub fn dynamic_library_name<T>(self, dynamic_library_name: T) -> Builder where
T: Into<String>,
pub fn dynamic_library_name<T>(self, dynamic_library_name: T) -> Builder where
T: Into<String>,
Specify the dynamic library name if we are generating bindings for a shared library.
Require successful linkage for all routines in a shared library. This allows us to optimize function calls by being able to safely assume function pointers are valid.
Generate bindings as pub
only if the bound item is publically accessible by C++.
Always translate enum integer types to native Rust integer types.
This will result in enums having types such as u32
and i16
instead
of c_uint
and c_short
. Types for Rustified enums are always
translated.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Builder
impl UnwindSafe for Builder
Blanket Implementations
Mutably borrows from an owned value. Read more
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
Causes self
to use its Binary
implementation when Debug
-formatted.
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
Causes self
to use its Octal
implementation when Debug
-formatted.
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
impl<T> Pipe for T where
T: ?Sized,
impl<T> Pipe for T where
T: ?Sized,
Pipes by value. This is generally the method you want to use. Read more
Borrows self
and passes that borrow into the pipe function. Read more
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
Mutably borrows self
and passes that borrow into the pipe function. Read more
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
Borrows self
, then passes self.borrow()
into the pipe function. Read more
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.as_ref()
into the pipe function.
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.deref()
into the pipe function.
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
Pipes a dereference into a function that cannot normally be called in suffix position. Read more
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more
Pipes a reference into a function that cannot ordinarily be called in suffix position. Read more
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Immutable access to the Borrow<B>
of a value. Read more
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the BorrowMut<B>
of a value. Read more
Immutable access to the AsRef<R>
view of a value. Read more
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Mutable access to the AsMut<R>
view of a value. Read more
Immutable access to the Deref::Target
of a value. Read more
Mutable access to the Deref::Target
of a value. Read more
Calls .tap()
only in debug builds, and is erased in release builds.
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more
Provides immutable access for inspection. Read more
Calls tap
in debug builds, and does nothing in release builds.
Provides mutable access for modification. Read more
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Calls tap_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
Provides immutable access to the reference for inspection.
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Calls tap_ref
in debug builds, and does nothing in release builds.
fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Provides mutable access to the reference for modification.
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_ref_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Provides immutable access to the borrow for inspection. Read more
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Calls tap_borrow
in debug builds, and does nothing in release builds.
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Provides mutable access to the borrow for modification.
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_borrow_mut
in debug builds, and does nothing in release
builds. Read more
Immutably dereferences self
for inspection.
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Calls tap_deref
in debug builds, and does nothing in release builds.
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Mutably dereferences self
for modification.
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Calls tap_deref_mut
in debug builds, and does nothing in release
builds. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more