Skip to content

Commit

Permalink
Various documentation fixes (#2460)
Browse files Browse the repository at this point in the history
* Remove typos from CLI docs

* Include `override_abi` as a regex based option

* Document that `--no-copy` also removes `Clone`
  • Loading branch information
pvdrz committed Mar 23, 2023
1 parent aad98d2 commit b3ed209
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions bindgen-cli/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct BindgenCommand {
/// Derive Default on any type.
#[arg(long)]
with_derive_default: bool,
/// Derive Hash on any type.docstring
/// Derive Hash on any type.
#[arg(long)]
with_derive_hash: bool,
/// Derive PartialEq on any type.
Expand Down Expand Up @@ -198,7 +198,7 @@ struct BindgenCommand {
/// Suppress insertion of bindgen's version identifier into generated bindings.
#[arg(long)]
disable_header_comment: bool,
/// Do not generate bindings for functions or methods. This is useful when you only care about struct layouts.docstring
/// Do not generate bindings for functions or methods. This is useful when you only care about struct layouts.
#[arg(long)]
ignore_functions: bool,
/// Generate only given items, split by commas. Valid values are `functions`,`types`, `vars`, `methods`, `constructors` and `destructors`.
Expand Down Expand Up @@ -275,7 +275,7 @@ struct BindgenCommand {
/// Avoid deriving PartialEq for types matching <REGEX>.
#[arg(long, value_name = "REGEX")]
no_partialeq: Vec<String>,
/// Avoid deriving Copy for types matching <REGEX>.
/// Avoid deriving Copy and Clone for types matching <REGEX>.
#[arg(long, value_name = "REGEX")]
no_copy: Vec<String>,
/// Avoid deriving Debug for types matching <REGEX>.
Expand Down
21 changes: 11 additions & 10 deletions bindgen/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1678,8 +1678,7 @@ impl Builder {
}

fn_with_regex_arg! {
/// Don't derive `Copy` for a given type. Regular
/// expressions are supported.
/// Don't derive `Copy` and `Clone` for a given type. Regular expressions are supported.
pub fn no_copy<T: Into<String>>(mut self, arg: T) -> Self {
self.options.no_copy_types.insert(arg.into());
self
Expand Down Expand Up @@ -1779,14 +1778,16 @@ impl Builder {
self
}

/// Override the ABI of a given function. Regular expressions are supported.
pub fn override_abi<T: Into<String>>(mut self, abi: Abi, arg: T) -> Self {
self.options
.abi_overrides
.entry(abi)
.or_default()
.insert(arg.into());
self
fn_with_regex_arg! {
/// Override the ABI of a given function. Regular expressions are supported.
pub fn override_abi<T: Into<String>>(mut self, abi: Abi, arg: T) -> Self {
self.options
.abi_overrides
.entry(abi)
.or_default()
.insert(arg.into());
self
}
}

/// If true, wraps unsafe operations in unsafe blocks.
Expand Down

0 comments on commit b3ed209

Please sign in to comment.