🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

cbindgen

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cbindgen - cargo Package Compare versions

Comparing version
0.29.0
to
0.29.1
tests/expectations-symbols/duplicated_constants.c.sym

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

+16
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct Foo {
uint32_t field;
} Foo;
#define Foo_FIELD_RELATED_CONSTANT 0
typedef struct Bar {
uint32_t field;
} Bar;
#define Bar_FIELD_RELATED_CONSTANT 0
void root(struct Foo a, struct Bar b);
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct Foo {
uint32_t field;
} Foo;
#define Foo_FIELD_RELATED_CONSTANT 0
typedef struct Bar {
uint32_t field;
} Bar;
#define Bar_FIELD_RELATED_CONSTANT 0
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(struct Foo a, struct Bar b);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
struct Foo {
uint32_t field;
};
#define Foo_FIELD_RELATED_CONSTANT 0
struct Bar {
uint32_t field;
};
#define Bar_FIELD_RELATED_CONSTANT 0
void root(struct Foo a, struct Bar b);
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
struct Foo {
uint32_t field;
};
#define Foo_FIELD_RELATED_CONSTANT 0
struct Bar {
uint32_t field;
};
#define Bar_FIELD_RELATED_CONSTANT 0
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(struct Foo a, struct Bar b);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
cdef extern from *:
ctypedef bint bool
ctypedef struct va_list
cdef extern from *:
cdef struct Foo:
uint32_t field;
const uint32_t Foo_FIELD_RELATED_CONSTANT # = 0
cdef struct Bar:
uint32_t field;
const uint32_t Bar_FIELD_RELATED_CONSTANT # = 0
void root(Foo a, Bar b);
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct {
uint32_t field;
} Foo;
#define Foo_FIELD_RELATED_CONSTANT 0
typedef struct {
uint32_t field;
} Bar;
#define Bar_FIELD_RELATED_CONSTANT 0
void root(Foo a, Bar b);
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct {
uint32_t field;
} Foo;
#define Foo_FIELD_RELATED_CONSTANT 0
typedef struct {
uint32_t field;
} Bar;
#define Bar_FIELD_RELATED_CONSTANT 0
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(Foo a, Bar b);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
struct Foo {
uint32_t field;
};
constexpr static const uint32_t Foo_FIELD_RELATED_CONSTANT = 0;
struct Bar {
uint32_t field;
};
constexpr static const uint32_t Bar_FIELD_RELATED_CONSTANT = 0;
extern "C" {
void root(Foo a, Bar b);
} // extern "C"
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
cdef extern from *:
ctypedef bint bool
ctypedef struct va_list
cdef extern from *:
ctypedef struct Foo:
uint32_t field;
const uint32_t Foo_FIELD_RELATED_CONSTANT # = 0
ctypedef struct Bar:
uint32_t field;
const uint32_t Bar_FIELD_RELATED_CONSTANT # = 0
void root(Foo a, Bar b);
#if 0
''' '
#endif
// FIXME: Mis-generated in C mode with enum.prefix_with_name = false, and in
// C++ mode with it set to true...
#if defined(__cplusplus) && !defined(CBINDGEN_CPP_COMPAT)
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#define AXIS_SHIFT 3
#define SELF_WM_SHIFT 6
#define SELF_WM (1 << 6)
/**
* Specifies which tracks(s) on the axis that the position-area span occupies.
* Represented as 3 bits: start, center, end track.
*/
enum PositionAreaTrack {
/**
* First track
*/
Start = 1,
/**
* First and center.
*/
SpanStart = 3,
/**
* Last track.
*/
End = 4,
/**
* Last and center.
*/
SpanEnd = 6,
/**
* Center track.
*/
Center = 2,
/**
* All tracks
*/
SpanAll = 7,
};
typedef uint8_t PositionAreaTrack;
/**
* A three-bit value that represents the axis in which position-area operates on.
* Represented as 3 bits: axis type (physical or logical), direction type (physical or logical),
* axis value.
*/
enum PositionAreaAxis {
Horizontal = 0,
Vertical = 1,
X = 2,
Y = 3,
Inline = 6,
Block = 7,
};
typedef uint8_t PositionAreaAxis;
/**
* Possible values for the `position-area` property's keywords.
* Represented by [0z xxx yyy], where z means "self wm resolution", xxx is the type (as in
* PositionAreaAxis and yyy is the PositionAreaTrack
* https://drafts.csswg.org/css-anchor-position-1/#propdef-position-area
*/
enum PositionAreaKeyword {
None = 0,
Center = (uint8_t)PositionAreaTrack_Center,
SpanAll = (uint8_t)PositionAreaTrack_SpanAll,
Start = (uint8_t)PositionAreaTrack_Start,
End = (uint8_t)PositionAreaTrack_End,
SpanStart = (uint8_t)PositionAreaTrack_SpanStart,
SpanEnd = (uint8_t)PositionAreaTrack_SpanEnd,
Top = (((uint8_t)PositionAreaAxis_Vertical << AXIS_SHIFT) | (uint8_t)PositionAreaTrack_Start),
Bottom = (((uint8_t)PositionAreaAxis_Vertical << AXIS_SHIFT) | (uint8_t)PositionAreaTrack_End),
};
typedef uint8_t PositionAreaKeyword;
void root(PositionAreaKeyword, PositionAreaTrack, PositionAreaAxis);
#endif
#if 0
' '''
#endif
#if 0
''' '
#endif
// FIXME: Mis-generated in C mode with enum.prefix_with_name = false, and in
// C++ mode with it set to true...
#if defined(__cplusplus) && !defined(CBINDGEN_CPP_COMPAT)
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#define AXIS_SHIFT 3
#define SELF_WM_SHIFT 6
#define SELF_WM (1 << 6)
/**
* Specifies which tracks(s) on the axis that the position-area span occupies.
* Represented as 3 bits: start, center, end track.
*/
enum PositionAreaTrack
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
{
/**
* First track
*/
Start = 1,
/**
* First and center.
*/
SpanStart = 3,
/**
* Last track.
*/
End = 4,
/**
* Last and center.
*/
SpanEnd = 6,
/**
* Center track.
*/
Center = 2,
/**
* All tracks
*/
SpanAll = 7,
};
#ifndef __cplusplus
typedef uint8_t PositionAreaTrack;
#endif // __cplusplus
/**
* A three-bit value that represents the axis in which position-area operates on.
* Represented as 3 bits: axis type (physical or logical), direction type (physical or logical),
* axis value.
*/
enum PositionAreaAxis
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
{
Horizontal = 0,
Vertical = 1,
X = 2,
Y = 3,
Inline = 6,
Block = 7,
};
#ifndef __cplusplus
typedef uint8_t PositionAreaAxis;
#endif // __cplusplus
/**
* Possible values for the `position-area` property's keywords.
* Represented by [0z xxx yyy], where z means "self wm resolution", xxx is the type (as in
* PositionAreaAxis and yyy is the PositionAreaTrack
* https://drafts.csswg.org/css-anchor-position-1/#propdef-position-area
*/
enum PositionAreaKeyword
#ifdef __cplusplus
: uint8_t
#endif // __cplusplus
{
None = 0,
Center = (uint8_t)PositionAreaTrack_Center,
SpanAll = (uint8_t)PositionAreaTrack_SpanAll,
Start = (uint8_t)PositionAreaTrack_Start,
End = (uint8_t)PositionAreaTrack_End,
SpanStart = (uint8_t)PositionAreaTrack_SpanStart,
SpanEnd = (uint8_t)PositionAreaTrack_SpanEnd,
Top = (((uint8_t)PositionAreaAxis_Vertical << AXIS_SHIFT) | (uint8_t)PositionAreaTrack_Start),
Bottom = (((uint8_t)PositionAreaAxis_Vertical << AXIS_SHIFT) | (uint8_t)PositionAreaTrack_End),
};
#ifndef __cplusplus
typedef uint8_t PositionAreaKeyword;
#endif // __cplusplus
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(PositionAreaKeyword, PositionAreaTrack, PositionAreaAxis);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif
#if 0
' '''
#endif
#if 0
''' '
#endif
// FIXME: Mis-generated in C mode with enum.prefix_with_name = false, and in
// C++ mode with it set to true...
#if defined(__cplusplus) && !defined(CBINDGEN_CPP_COMPAT)
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
constexpr static const uintptr_t AXIS_SHIFT = 3;
constexpr static const uintptr_t SELF_WM_SHIFT = 6;
constexpr static const uint8_t SELF_WM = (1 << 6);
/// Specifies which tracks(s) on the axis that the position-area span occupies.
/// Represented as 3 bits: start, center, end track.
enum class PositionAreaTrack : uint8_t {
/// First track
Start = 1,
/// First and center.
SpanStart = 3,
/// Last track.
End = 4,
/// Last and center.
SpanEnd = 6,
/// Center track.
Center = 2,
/// All tracks
SpanAll = 7,
};
/// A three-bit value that represents the axis in which position-area operates on.
/// Represented as 3 bits: axis type (physical or logical), direction type (physical or logical),
/// axis value.
enum class PositionAreaAxis : uint8_t {
Horizontal = 0,
Vertical = 1,
X = 2,
Y = 3,
Inline = 6,
Block = 7,
};
/// Possible values for the `position-area` property's keywords.
/// Represented by [0z xxx yyy], where z means "self wm resolution", xxx is the type (as in
/// PositionAreaAxis and yyy is the PositionAreaTrack
/// https://drafts.csswg.org/css-anchor-position-1/#propdef-position-area
enum class PositionAreaKeyword : uint8_t {
None = 0,
Center = (uint8_t)PositionAreaTrack::Center,
SpanAll = (uint8_t)PositionAreaTrack::SpanAll,
Start = (uint8_t)PositionAreaTrack::Start,
End = (uint8_t)PositionAreaTrack::End,
SpanStart = (uint8_t)PositionAreaTrack::SpanStart,
SpanEnd = (uint8_t)PositionAreaTrack::SpanEnd,
Top = (((uint8_t)PositionAreaAxis::Vertical << AXIS_SHIFT) | (uint8_t)PositionAreaTrack::Start),
Bottom = (((uint8_t)PositionAreaAxis::Vertical << AXIS_SHIFT) | (uint8_t)PositionAreaTrack::End),
};
extern "C" {
void root(PositionAreaKeyword, PositionAreaTrack, PositionAreaAxis);
} // extern "C"
#endif
#if 0
' '''
#endif
#if 0
''' '
#endif
// FIXME: Mis-generated in C mode with enum.prefix_with_name = false, and in
// C++ mode with it set to true...
#if defined(__cplusplus) && !defined(CBINDGEN_CPP_COMPAT)
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
cdef extern from *:
ctypedef bint bool
ctypedef struct va_list
cdef extern from *:
const uintptr_t AXIS_SHIFT # = 3
const uintptr_t SELF_WM_SHIFT # = 6
const uint8_t SELF_WM # = (1 << 6)
# Specifies which tracks(s) on the axis that the position-area span occupies.
# Represented as 3 bits: start, center, end track.
cdef enum:
# First track
Start # = 1,
# First and center.
SpanStart # = 3,
# Last track.
End # = 4,
# Last and center.
SpanEnd # = 6,
# Center track.
Center # = 2,
# All tracks
SpanAll # = 7,
ctypedef uint8_t PositionAreaTrack;
# A three-bit value that represents the axis in which position-area operates on.
# Represented as 3 bits: axis type (physical or logical), direction type (physical or logical),
# axis value.
cdef enum:
Horizontal # = 0,
Vertical # = 1,
X # = 2,
Y # = 3,
Inline # = 6,
Block # = 7,
ctypedef uint8_t PositionAreaAxis;
# Possible values for the `position-area` property's keywords.
# Represented by [0z xxx yyy], where z means "self wm resolution", xxx is the type (as in
# PositionAreaAxis and yyy is the PositionAreaTrack
# https://drafts.csswg.org/css-anchor-position-1/#propdef-position-area
cdef enum:
None # = 0,
Center # = <uint8_t>PositionAreaTrack_Center,
SpanAll # = <uint8_t>PositionAreaTrack_SpanAll,
Start # = <uint8_t>PositionAreaTrack_Start,
End # = <uint8_t>PositionAreaTrack_End,
SpanStart # = <uint8_t>PositionAreaTrack_SpanStart,
SpanEnd # = <uint8_t>PositionAreaTrack_SpanEnd,
Top # = ((<uint8_t>PositionAreaAxis_Vertical << AXIS_SHIFT) | <uint8_t>PositionAreaTrack_Start),
Bottom # = ((<uint8_t>PositionAreaAxis_Vertical << AXIS_SHIFT) | <uint8_t>PositionAreaTrack_End),
ctypedef uint8_t PositionAreaKeyword;
void root(PositionAreaKeyword, PositionAreaTrack, PositionAreaAxis);
#endif
#if 0
' '''
#endif
#[repr(C)]
pub struct Foo {
field: u32,
}
impl Foo {
pub const FIELD_RELATED_CONSTANT: u32 = 0;
}
#[repr(C)]
pub struct Bar {
field: u32,
}
impl Bar {
pub const FIELD_RELATED_CONSTANT: u32 = 0;
}
#[no_mangle]
pub extern "C" fn root(a: Foo, b: Bar) {}
/// A three-bit value that represents the axis in which position-area operates on.
/// Represented as 3 bits: axis type (physical or logical), direction type (physical or logical),
/// axis value.
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum PositionAreaAxis {
Horizontal = 0b000,
Vertical = 0b001,
X = 0b010,
Y = 0b011,
Inline = 0b110,
Block = 0b111,
}
/// Specifies which tracks(s) on the axis that the position-area span occupies.
/// Represented as 3 bits: start, center, end track.
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum PositionAreaTrack {
/// First track
Start = 0b001,
/// First and center.
SpanStart = 0b011,
/// Last track.
End = 0b100,
/// Last and center.
SpanEnd = 0b110,
/// Center track.
Center = 0b010,
/// All tracks
SpanAll = 0b111,
}
pub const AXIS_SHIFT: usize = 3;
pub const SELF_WM_SHIFT: usize = 6;
pub const SELF_WM: u8 = 1u8 << 6;
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
#[allow(missing_docs)]
#[repr(u8)]
/// Possible values for the `position-area` property's keywords.
/// Represented by [0z xxx yyy], where z means "self wm resolution", xxx is the type (as in
/// PositionAreaAxis and yyy is the PositionAreaTrack
/// https://drafts.csswg.org/css-anchor-position-1/#propdef-position-area
pub enum PositionAreaKeyword {
#[default]
None = 0,
Center = PositionAreaTrack::Center as u8,
SpanAll = PositionAreaTrack::SpanAll as u8,
Start = PositionAreaTrack::Start as u8,
End = PositionAreaTrack::End as u8,
SpanStart = PositionAreaTrack::SpanStart as u8,
SpanEnd = PositionAreaTrack::SpanEnd as u8,
Top = ((PositionAreaAxis::Vertical as u8) << AXIS_SHIFT) | PositionAreaTrack::Start as u8,
Bottom = ((PositionAreaAxis::Vertical as u8) << AXIS_SHIFT) | PositionAreaTrack::End as u8,
}
#[no_mangle]
extern "C" fn root(_: PositionAreaKeyword, _: PositionAreaTrack, _: PositionAreaAxis) {}
header = """
#if 0
''' '
#endif
// FIXME: Mis-generated in C mode with enum.prefix_with_name = false, and in
// C++ mode with it set to true...
#if defined(__cplusplus) && !defined(CBINDGEN_CPP_COMPAT)
"""
trailer = """
#endif
#if 0
' '''
#endif
"""
[enum]
enum_class = true
# prefix_with_name = true
[struct]
associated_constants_in_body = true
+1
-1
{
"git": {
"sha1": "802154245edebe6bd031e473737da4c2fbdea8a3"
"sha1": "eef17769e2739ebb425fee0bbd88e6a52ac2a4e1"
},
"path_in_vcs": ""
}

@@ -6,6 +6,6 @@ name: cbindgen

branches:
- master
- main
pull_request:
branches:
- master
- main
merge_group:

@@ -12,0 +12,0 @@ types:

+142
-106

@@ -7,5 +7,5 @@ # This file is automatically @generated by Cargo.

name = "anstream"
version = "0.6.15"
version = "0.6.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933"
dependencies = [

@@ -23,11 +23,11 @@ "anstyle",

name = "anstyle"
version = "1.0.8"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
[[package]]
name = "anstyle-parse"
version = "0.2.5"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
dependencies = [

@@ -39,7 +39,7 @@ "utf8parse",

name = "anstyle-query"
version = "1.1.1"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9"
dependencies = [
"windows-sys 0.52.0",
"windows-sys",
]

@@ -49,8 +49,9 @@

name = "anstyle-wincon"
version = "3.0.4"
version = "3.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882"
dependencies = [
"anstyle",
"windows-sys 0.52.0",
"once_cell_polyfill",
"windows-sys",
]

@@ -60,15 +61,15 @@

name = "autocfg"
version = "1.3.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "bitflags"
version = "2.6.0"
version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
[[package]]
name = "cbindgen"
version = "0.29.0"
version = "0.29.1"
dependencies = [

@@ -92,11 +93,11 @@ "clap",

name = "cfg-if"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]]
name = "clap"
version = "4.5.15"
version = "4.5.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc"
checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9"
dependencies = [

@@ -108,5 +109,5 @@ "clap_builder",

name = "clap_builder"
version = "4.5.15"
version = "4.5.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6"
checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d"
dependencies = [

@@ -121,11 +122,11 @@ "anstream",

name = "clap_lex"
version = "0.7.2"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
[[package]]
name = "colorchoice"
version = "1.0.2"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"

@@ -153,14 +154,14 @@ [[package]]

name = "equivalent"
version = "1.0.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "errno"
version = "0.3.9"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
dependencies = [
"libc",
"windows-sys 0.52.0",
"windows-sys",
]

@@ -170,7 +171,19 @@

name = "fastrand"
version = "2.1.0"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "getrandom"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
dependencies = [
"cfg-if",
"libc",
"r-efi",
"wasi",
]
[[package]]
name = "hashbrown"

@@ -189,5 +202,5 @@ version = "0.14.5"

name = "indexmap"
version = "2.3.0"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0"
checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
dependencies = [

@@ -206,5 +219,5 @@ "equivalent",

name = "itoa"
version = "1.0.11"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"

@@ -219,17 +232,17 @@ [[package]]

name = "libc"
version = "0.2.155"
version = "0.2.174"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
[[package]]
name = "linux-raw-sys"
version = "0.4.14"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
[[package]]
name = "lock_api"
version = "0.4.12"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765"
dependencies = [

@@ -242,23 +255,29 @@ "autocfg",

name = "log"
version = "0.4.22"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "memchr"
version = "2.7.4"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
[[package]]
name = "once_cell"
version = "1.19.0"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "once_cell_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
[[package]]
name = "parking_lot"
version = "0.12.3"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13"
dependencies = [

@@ -271,5 +290,5 @@ "lock_api",

name = "parking_lot_core"
version = "0.9.10"
version = "0.9.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5"
dependencies = [

@@ -285,5 +304,5 @@ "cfg-if",

name = "pretty_assertions"
version = "1.4.0"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66"
checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d"
dependencies = [

@@ -296,5 +315,5 @@ "diff",

name = "proc-macro2"
version = "1.0.86"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [

@@ -306,5 +325,5 @@ "unicode-ident",

name = "quote"
version = "1.0.36"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [

@@ -315,6 +334,12 @@ "proc-macro2",

[[package]]
name = "r-efi"
version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
name = "redox_syscall"
version = "0.5.3"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4"
checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6"
dependencies = [

@@ -326,5 +351,5 @@ "bitflags",

name = "rustix"
version = "0.38.34"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"
dependencies = [

@@ -335,3 +360,3 @@ "bitflags",

"linux-raw-sys",
"windows-sys 0.52.0",
"windows-sys",
]

@@ -341,5 +366,5 @@

name = "ryu"
version = "1.0.18"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"

@@ -354,5 +379,5 @@ [[package]]

name = "serde"
version = "1.0.205"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150"
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
dependencies = [

@@ -364,5 +389,5 @@ "serde_derive",

name = "serde_derive"
version = "1.0.205"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1"
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [

@@ -376,5 +401,5 @@ "proc-macro2",

name = "serde_json"
version = "1.0.122"
version = "1.0.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da"
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
dependencies = [

@@ -389,5 +414,5 @@ "itoa",

name = "serde_spanned"
version = "0.6.7"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d"
checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83"
dependencies = [

@@ -422,5 +447,5 @@ "serde",

name = "smallvec"
version = "1.13.2"
version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"

@@ -435,5 +460,5 @@ [[package]]

name = "syn"
version = "2.0.85"
version = "2.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56"
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
dependencies = [

@@ -447,11 +472,11 @@ "proc-macro2",

name = "tempfile"
version = "3.12.0"
version = "3.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64"
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
dependencies = [
"cfg-if",
"fastrand",
"getrandom",
"once_cell",
"rustix",
"windows-sys 0.59.0",
"windows-sys",
]

@@ -461,10 +486,13 @@

name = "toml"
version = "0.8.19"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
checksum = "ed0aee96c12fa71097902e0bb061a5e1ebd766a6636bb605ba401c45c1650eac"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
"toml_parser",
"toml_writer",
"winnow",
]

@@ -474,5 +502,5 @@

name = "toml_datetime"
version = "0.6.8"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3"
dependencies = [

@@ -483,11 +511,7 @@ "serde",

[[package]]
name = "toml_edit"
version = "0.22.20"
name = "toml_parser"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d"
checksum = "97200572db069e74c512a14117b296ba0a80a30123fbbb5aa1f4a348f639ca30"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",

@@ -497,6 +521,12 @@ ]

[[package]]
name = "toml_writer"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64"
[[package]]
name = "unicode-ident"
version = "1.0.12"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"

@@ -510,8 +540,8 @@ [[package]]

[[package]]
name = "windows-sys"
version = "0.52.0"
name = "wasi"
version = "0.14.2+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
dependencies = [
"windows-targets",
"wit-bindgen-rt",
]

@@ -594,7 +624,13 @@

name = "winnow"
version = "0.6.18"
version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f"
checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95"
[[package]]
name = "wit-bindgen-rt"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
dependencies = [
"memchr",
"bitflags",
]

@@ -604,4 +640,4 @@

name = "yansi"
version = "0.5.1"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"

@@ -13,6 +13,6 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO

[package]
edition = "2018"
edition = "2021"
rust-version = "1.74"
name = "cbindgen"
version = "0.29.0"
version = "0.29.1"
authors = [

@@ -110,3 +110,9 @@ "Emilio Cobos Álvarez <emilio@crisal.io>",

[dependencies.toml]
version = "0.8.8"
version = "0.9"
features = [
"parse",
"serde",
"std",
]
default-features = false

@@ -113,0 +119,0 @@ [dev-dependencies.pretty_assertions]

+10
-0
# unreleased
# 0.29.1
* cf13c2b enum: Track dependencies properly in enumerations.
* 307d1e9 constant: Handle cfg in associated constants.
* 0902d02 Remove "display" feature from the toml crate
* 9068410 Fix incorrect detection of duplicated constants
* 451e768 docs: Correct after_include type in example config (fix)
* aff68c6 cargo update
* 09666f6 Update toml to 0.9
# 0.29.0

@@ -4,0 +14,0 @@

@@ -516,3 +516,3 @@ # cbindgen User Guide

# A list of lines to add verbatim after the includes block
# A block of text to add verbatim after the includes block
after_includes = "#define VERSION 1"

@@ -519,0 +519,0 @@

@@ -10,3 +10,3 @@ # `cbindgen` &emsp; [![Build Status]][actions] [![Latest Version]][crates.io] [![Api Rustdoc]][rustdoc] [![Rust](https://img.shields.io/badge/rust-1.70%2B-blue.svg?maxAge=3600)](https://github.com/mozilla/cbindgen)

[Read the full user docs here!](https://github.com/mozilla/cbindgen/blob/master/docs.md)
[Read the full user docs here!](https://github.com/mozilla/cbindgen/blob/main/docs.md)

@@ -91,2 +91,3 @@ cbindgen creates C/C++11 headers for Rust libraries which expose a public C API.

* [tquic](https://github.com/Tencent/tquic) ([generated header](https://github.com/Tencent/tquic/blob/develop/include/tquic.h))
* [metatensor](https://github.com/metatensor/metatensor) ([generated header](https://github.com/metatensor/metatensor/blob/main/metatensor-core/include/metatensor.h))

@@ -93,0 +94,0 @@ If you're using `cbindgen` and would like to be added to this list, please open

@@ -156,3 +156,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

for symbol in self.dynamic_symbols_names() {
writeln!(&mut writer, "{};", symbol).expect("writing symbol failed");
writeln!(&mut writer, "{symbol};").expect("writing symbol failed");
}

@@ -159,0 +159,0 @@ write!(&mut writer, "}};").expect("writing symbol file footer failed");

@@ -275,3 +275,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

self.config.defines.insert(
format!("target_os = {}", platform),
format!("target_os = {platform}"),
preprocessor_define.to_owned(),

@@ -284,6 +284,5 @@ );

pub fn with_define(mut self, key: &str, value: &str, preprocessor_define: &str) -> Builder {
self.config.defines.insert(
format!("{} = {}", key, value),
preprocessor_define.to_owned(),
);
self.config
.defines
.insert(format!("{key} = {value}"), preprocessor_define.to_owned());
self

@@ -290,0 +289,0 @@ }

@@ -44,3 +44,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

Error::Utf8(ref err) => err.fmt(f),
Error::Compile(ref err) => write!(f, "{}", err),
Error::Compile(ref err) => write!(f, "{err}"),
}

@@ -135,3 +135,3 @@ }

cmd.arg("-Zunpretty=expanded");
info!("Command: {:?}", cmd);
info!("Command: {cmd:?}");
let output = cmd.output()?;

@@ -138,0 +138,0 @@

@@ -193,3 +193,3 @@ #![deny(missing_docs)]

let rustc = env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
debug!("Discovering host platform by {:?}", rustc);
debug!("Discovering host platform by {rustc:?}");

@@ -196,0 +196,0 @@ let rustc_output = Command::new(rustc)

@@ -58,3 +58,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

Err(x) => {
warn!("Couldn't load lock file {:?}: {:?}", lock_path, x);
warn!("Couldn't load lock file {lock_path:?}: {x:?}");
None

@@ -161,3 +161,3 @@ }

} else {
warn!("when looking for a version for package {}, multiple versions where found", dep_name);
warn!("when looking for a version for package {dep_name}, multiple versions where found");
None

@@ -164,0 +164,0 @@ }

@@ -115,4 +115,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

self.type_qualifers.is_empty(),
"error generating cdecl for {:?}",
t
"error generating cdecl for {t:?}"
);

@@ -124,4 +123,3 @@ "const".clone_into(&mut self.type_qualifers);

self.type_name.is_empty(),
"error generating cdecl for {:?}",
t
"error generating cdecl for {t:?}"
);

@@ -131,4 +129,3 @@ generic.export_name().clone_into(&mut self.type_name);

self.type_generic_args.is_empty(),
"error generating cdecl for {:?}",
t
"error generating cdecl for {t:?}"
);

@@ -142,4 +139,3 @@ generic.generics().clone_into(&mut self.type_generic_args);

self.type_qualifers.is_empty(),
"error generating cdecl for {:?}",
t
"error generating cdecl for {t:?}"
);

@@ -151,4 +147,3 @@ "const".clone_into(&mut self.type_qualifers);

self.type_name.is_empty(),
"error generating cdecl for {:?}",
t
"error generating cdecl for {t:?}"
);

@@ -258,7 +253,7 @@ self.type_name = p.to_repr_c(config).to_string();

if let Some(attr) = &config.pointer.non_null_attribute {
write!(out, "{} ", attr);
write!(out, "{attr} ");
}
} else if is_nullable {
if let Some(attr) = &config.pointer.nullable_attribute {
write!(out, "{} ", attr);
write!(out, "{attr} ");
}

@@ -283,3 +278,3 @@ }

if let Some(ident) = ident {
write!(out, "{}", ident);
write!(out, "{ident}");
}

@@ -301,3 +296,3 @@

}
write!(out, "[{}]", constant);
write!(out, "[{constant}]");

@@ -376,3 +371,3 @@ last_was_pointer = false;

if let Some(ref no_return_attr) = config.function.no_return {
out.write_fmt(format_args!(" {}", no_return_attr));
out.write_fmt(format_args!(" {no_return_attr}"));
}

@@ -379,0 +374,0 @@ }

@@ -45,3 +45,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

"Cython" => Ok(Language::Cython),
_ => Err(format!("Unrecognized Language: '{}'.", s)),
_ => Err(format!("Unrecognized Language: '{s}'.")),
}

@@ -107,3 +107,3 @@ }

"cr" => Ok(Self::CR),
_ => Err(format!("Unrecognized line ending style: '{}'.", s)),
_ => Err(format!("Unrecognized line ending style: '{s}'.")),
}

@@ -131,3 +131,3 @@ }

"next_line" => Ok(Braces::NextLine),
_ => Err(format!("Unrecognized Braces: '{}'.", s)),
_ => Err(format!("Unrecognized Braces: '{s}'.")),
}

@@ -158,3 +158,3 @@ }

"auto" => Ok(Layout::Auto),
_ => Err(format!("Unrecognized Layout: '{}'.", s)),
_ => Err(format!("Unrecognized Layout: '{s}'.")),
}

@@ -187,3 +187,3 @@ }

"auto" => Ok(DocumentationStyle::Auto),
_ => Err(format!("Unrecognized documentation style: '{}'.", s)),
_ => Err(format!("Unrecognized documentation style: '{s}'.")),
}

@@ -209,3 +209,3 @@ }

"full" => Ok(DocumentationLength::Full),
_ => Err(format!("Unrecognized documentation style: '{}'.", s)),
_ => Err(format!("Unrecognized documentation style: '{s}'.")),
}

@@ -262,3 +262,3 @@ }

"type" => Ok(Style::Type),
_ => Err(format!("Unrecognized Style: '{}'.", s)),
_ => Err(format!("Unrecognized Style: '{s}'.")),
}

@@ -297,3 +297,3 @@ }

"functions" => Functions,
_ => return Err(format!("Unrecognized Style: '{}'.", s)),
_ => return Err(format!("Unrecognized Style: '{s}'.")),
})

@@ -320,3 +320,3 @@ }

"none" => None,
_ => return Err(format!("Unrecognized sort option: '{}'.", s)),
_ => return Err(format!("Unrecognized sort option: '{s}'.")),
})

@@ -764,3 +764,3 @@ }

"release" | "Release" => Ok(Profile::Release),
_ => Err(format!("Unrecognized Profile: '{}'.", s)),
_ => Err(format!("Unrecognized Profile: '{s}'.")),
}

@@ -1131,3 +1131,3 @@ }

let mut config = toml::from_str::<Config>(&config_text)
.map_err(|e| format!("Couldn't parse config file: {}.", e))?;
.map_err(|e| format!("Couldn't parse config file: {e}."))?;
config.config_path = Some(StdPathBuf::from(file_name.as_ref()));

@@ -1134,0 +1134,0 @@ Ok(config)

@@ -8,3 +8,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

use crate::bindgen::ir::{ItemContainer, Path};
use crate::bindgen::{
ir::{ItemContainer, Path},
library::Library,
};

@@ -26,2 +29,21 @@ /// A dependency list is used for gathering what order to output the types.

pub fn add(&mut self, library: &Library, path: &Path) {
let Some(items) = library.get_items(path) else {
warn!(
"Can't find {path}. This usually means that this type was incompatible or not found."
);
return;
};
if self.items.contains(path) {
return;
}
self.items.insert(path.clone());
for item in &items {
item.deref().add_dependencies(library, self);
}
for item in items {
self.order.push(item);
}
}
pub fn sort(&mut self) {

@@ -34,3 +56,3 @@ // Sort untagged enums and opaque structs into their own layers because they don't

{
x.path.cmp(&y.path)
Ordering::Equal
}

@@ -37,0 +59,0 @@ (ItemContainer::Enum(x), _) if x.tag.is_none() => Ordering::Less,

@@ -35,12 +35,10 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

f,
"Couldn't execute `cargo metadata` with manifest {:?}: {:?}",
path, error
"Couldn't execute `cargo metadata` with manifest {path:?}: {error:?}"
),
Error::CargoToml(ref path, ref error) => {
write!(f, "Couldn't load manifest file {:?}: {:?}", path, error)
write!(f, "Couldn't load manifest file {path:?}: {error:?}")
}
Error::CargoExpand(ref crate_name, ref error) => write!(
f,
"Parsing crate `{}`: couldn't run `cargo rustc -Zunpretty=expanded`: {:?}",
crate_name, error
"Parsing crate `{crate_name}`: couldn't run `cargo rustc -Zunpretty=expanded`: {error:?}"
),

@@ -54,4 +52,3 @@ Error::ParseSyntaxError {

f,
"Parsing crate `{}`:`{}`:\n{:?}",
crate_name, src_path, error
"Parsing crate `{crate_name}`:`{src_path}`:\n{error:?}"
)?;

@@ -62,4 +59,3 @@

f,
"\nTry running `rustc -Z parse-crate-root-only {}` to see a nicer error message",
src_path,
"\nTry running `rustc -Z parse-crate-root-only {src_path}` to see a nicer error message",
)?

@@ -74,4 +70,3 @@ }

f,
"Parsing crate `{}`: cannot open file `{}`.",
crate_name, src_path
"Parsing crate `{crate_name}`: cannot open file `{src_path}`."
),

@@ -78,0 +73,0 @@ }

@@ -99,3 +99,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

.as_ref()?;
Some(Cow::Owned(format.replace("{}", &format!("{:?}", note))))
Some(Cow::Owned(format.replace("{}", &format!("{note:?}"))))
}

@@ -117,3 +117,3 @@

let must_use = attrs.has_attr_word("must_use");
let must_use = attrs.has_attr_word("must_use") || attrs.has_attr_namevalue("must_use");
let deprecated = attrs.find_deprecated_note();

@@ -133,3 +133,3 @@ let mut annotations = HashMap::new();

if parts.len() > 2 {
return Err(format!("Couldn't parse {}.", line));
return Err(format!("Couldn't parse {line}."));
}

@@ -136,0 +136,0 @@

@@ -18,4 +18,4 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

impl DefineKey<'_> {
fn load(key: &str) -> DefineKey {
impl<'a> DefineKey<'a> {
fn load(key: &'a str) -> Self {
// TODO: dirty parser

@@ -58,4 +58,4 @@ if !key.contains('=') {

match self {
Cfg::Boolean(key) => write!(f, "{}", key),
Cfg::Named(key, value) => write!(f, "{} = {:?}", key, value),
Cfg::Boolean(key) => write!(f, "{key}"),
Cfg::Named(key, value) => write!(f, "{key} = {value:?}"),
Cfg::Any(cfgs) => {

@@ -67,3 +67,3 @@ write!(f, "any(")?;

}
write!(f, "{}", cfg)?;
write!(f, "{cfg}")?;
}

@@ -78,7 +78,7 @@ write!(f, ")")

}
write!(f, "{}", cfg)?;
write!(f, "{cfg}")?;
}
write!(f, ")")
}
Cfg::Not(cfg) => write!(f, "not({})", cfg),
Cfg::Not(cfg) => write!(f, "not({cfg})"),
}

@@ -220,6 +220,3 @@ }

} else {
warn!(
"Missing `[defines]` entry for `{}` in cbindgen config.",
self,
);
warn!("Missing `[defines]` entry for `{self}` in cbindgen config.",);
None

@@ -235,6 +232,3 @@ }

} else {
warn!(
"Missing `[defines]` entry for `{}` in cbindgen config.",
self,
);
warn!("Missing `[defines]` entry for `{self}` in cbindgen config.",);
None

@@ -285,6 +279,6 @@ }

if config.language == Language::Cython {
write!(out, "{}", define);
write!(out, "{define}");
} else {
out.write("defined(");
write!(out, "{}", define);
write!(out, "{define}");
out.write(")");

@@ -291,0 +285,0 @@ }

@@ -79,3 +79,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

};
Some(format!("{}_{}", prefix, name))
Some(format!("{prefix}_{name}"))
}

@@ -121,3 +121,23 @@

impl Literal {
fn replace_self_with(&mut self, self_ty: &Path) {
pub fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
self.visit(&mut |lit| {
match lit {
Literal::Struct {
ref path,
export_name: _,
fields: _,
}
| Literal::Path {
associated_to: Some((ref path, _)),
name: _,
} => {
out.add(library, path);
}
_ => {}
}
true
});
}
pub fn replace_self_with(&mut self, self_ty: &Path) {
match *self {

@@ -338,4 +358,3 @@ Literal::PostfixUnaryOp { ref mut value, .. } => {

return Err(format!(
"unsupported binary operator: {:?}",
currently_unknown
"unsupported binary operator: {currently_unknown:?}"
))

@@ -357,3 +376,3 @@ }

0..=255 => format!("'{}'", value.value().escape_default()),
other_code => format!(r"U'\U{:08X}'", other_code),
other_code => format!(r"U'\U{other_code:08X}'"),
})),

@@ -474,3 +493,3 @@ syn::Lit::Int(ref value) => {

}
_ => return Err(format!("Unsupported path expression. {:?}", path)),
_ => return Err(format!("Unsupported path expression. {path:?}")),
})

@@ -555,3 +574,11 @@ }

) -> Self {
let export_name = path.name().to_owned();
let export_name = match associated_to.clone() {
Some(associated_to) => path
.name()
.strip_suffix(associated_to.name())
.unwrap()
.to_owned(),
None => path.name().to_owned(),
};
Self {

@@ -581,2 +608,3 @@ path,

self.ty.add_dependencies(library, out);
self.value.add_dependencies(library, out);
}

@@ -639,2 +667,4 @@

let condition = self.cfg.to_condition(config);
condition.write_before(config, out);
if let Type::Ptr { is_const: true, .. } = self.ty {

@@ -646,3 +676,4 @@ out.write("static ");

language_backend.write_type(out, &self.ty);
write!(out, " {};", self.export_name())
write!(out, " {};", self.export_name());
condition.write_after(config, out);
}

@@ -741,3 +772,3 @@

language_backend.write_type(out, &self.ty);
write!(out, " {} = ", name);
write!(out, " {name} = ");
language_backend.write_literal(out, value);

@@ -747,3 +778,3 @@ write!(out, ";");

Language::Cxx | Language::C => {
write!(out, "#define {} ", name);
write!(out, "#define {name} ");
language_backend.write_literal(out, value);

@@ -756,3 +787,3 @@ }

// but still useful as documentation, so we write it as a comment.
write!(out, " {} # = ", name);
write!(out, " {name} # = ");
language_backend.write_literal(out, value);

@@ -759,0 +790,0 @@ }

@@ -108,3 +108,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

let discriminant = match variant.discriminant {
Some((_, ref expr)) => Some(Literal::load(expr)?),
Some((_, ref expr)) => {
let mut discriminant = Literal::load(expr)?;
discriminant.replace_self_with(self_path);
Some(discriminant)
}
None => None,

@@ -123,3 +127,3 @@ };

res.push(Field::from_name_and_type(
inline_name.map_or_else(|| "tag".to_string(), |name| format!("{}_tag", name)),
inline_name.map_or_else(|| "tag".to_string(), |name| format!("{name}_tag")),
Type::Path(GenericPath::new(Path::new("Tag"), vec![])),

@@ -263,2 +267,5 @@ ));

}
if let Some(ref d) = self.discriminant {
d.add_dependencies(library, out);
}
}

@@ -675,5 +682,5 @@

{
write!(out, " {}", note);
write!(out, " {note}");
}
write!(out, " {}", tag_name);
write!(out, " {tag_name}");

@@ -684,3 +691,3 @@ if config.cpp_compatible_c() {

out.new_line();
write!(out, " : {}", prim);
write!(out, " : {prim}");
out.new_line();

@@ -699,6 +706,6 @@ out.write("#endif // __cplusplus");

{
write!(out, " {}", note);
write!(out, " {note}");
}
if config.style.generate_tag() {
write!(out, " {}", tag_name);
write!(out, " {tag_name}");
}

@@ -716,3 +723,3 @@ }

if let Some(ref anno) = config.enumeration.must_use {
write!(out, " {}", anno)
write!(out, " {anno}")
}

@@ -725,8 +732,8 @@ }

{
write!(out, " {}", note);
write!(out, " {note}");
}
write!(out, " {}", tag_name);
write!(out, " {tag_name}");
if let Some(prim) = size {
write!(out, " : {}", prim);
write!(out, " : {prim}");
}

@@ -757,3 +764,3 @@ }

out.close_brace(false);
write!(out, " {};", tag_name);
write!(out, " {tag_name};");
} else {

@@ -804,3 +811,3 @@ out.close_brace(true);

if let Some(ref anno) = config.structure.must_use {
write!(out, " {}", anno);
write!(out, " {anno}");
}

@@ -813,3 +820,3 @@ }

{
write!(out, " {} ", note);
write!(out, " {note} ");
}

@@ -884,3 +891,3 @@

write!(out, "{} tag;", tag_name);
write!(out, "{tag_name} tag;");

@@ -1018,3 +1025,3 @@ if wrap_tag {

}
write!(out, "switch ({})", instance);
write!(out, "switch ({instance})");
out.open_brace();

@@ -1035,3 +1042,3 @@ let vec: Vec<_> = self

ListType::Join(""),
|_, out, s| write!(out, "{}", s),
|_, out, s| write!(out, "{s}"),
);

@@ -1041,3 +1048,3 @@ out.close_brace(false);

write!(out, "return {};", stream);
write!(out, "return {stream};");
out.close_brace(false);

@@ -1070,3 +1077,3 @@

write!(out, "switch ({}.tag)", instance);
write!(out, "switch ({instance}.tag)");
out.open_brace();

@@ -1104,3 +1111,3 @@ let vec: Vec<_> = self

ListType::Join(""),
|_, out, s| write!(out, "{}", s),
|_, out, s| write!(out, "{s}"),
);

@@ -1110,3 +1117,3 @@ out.close_brace(false);

write!(out, "return {};", stream);
write!(out, "return {stream};");
out.close_brace(false);

@@ -1291,3 +1298,3 @@ }

out.new_line();
write!(out, "return {}", member_name);
write!(out, "return {member_name}");
if inline_casts {

@@ -1335,3 +1342,3 @@ write!(out, "._0");

out.open_brace();
write!(out, "if (tag != {}.tag)", other);
write!(out, "if (tag != {other}.tag)");
out.open_brace();

@@ -1387,3 +1394,3 @@ write!(out, "return false;");

out.open_brace();
write!(out, "return !(*this == {});", other);
write!(out, "return !(*this == {other});");
out.close_brace(false);

@@ -1462,3 +1469,3 @@ }

out.new_line();
write!(out, " : tag({}.tag)", other);
write!(out, " : tag({other}.tag)");
out.open_brace();

@@ -1509,3 +1516,3 @@ write!(out, "switch (tag)");

out.open_brace();
write!(out, "if (this != &{})", other);
write!(out, "if (this != &{other})");
out.open_brace();

@@ -1512,0 +1519,0 @@ write!(out, "this->~{}();", self.export_name);

@@ -93,3 +93,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

}
(format!("{}.", type_name), type_name)
(format!("{type_name}."), type_name)
}

@@ -112,3 +112,3 @@ None => ("".to_string(), "".to_string()),

};
Some(format!("{}{}({})", type_prefix, item_name, item_args))
Some(format!("{type_prefix}{item_name}({item_args})"))
}

@@ -201,4 +201,3 @@

warn!(
"{:?} does not follow the correct syntax, so the annotation is being ignored",
parts
"{parts:?} does not follow the correct syntax, so the annotation is being ignored"
);

@@ -271,4 +270,3 @@ continue;

return Err(format!(
"Parameter has an unsupported argument name: {:?}",
pat
"Parameter has an unsupported argument name: {pat:?}"
))

@@ -275,0 +273,0 @@ }

@@ -65,3 +65,3 @@ use std::io::Write;

// A type that evaporates, like PhantomData.
Err(format!("unsupported const generic type: {:?}", ty))
Err(format!("unsupported const generic type: {ty:?}"))
}

@@ -312,4 +312,3 @@ Some(ty) => Ok(Some(GenericParam {

!path.segments.is_empty(),
"{:?} doesn't have any segments",
path
"{path:?} doesn't have any segments"
);

@@ -335,3 +334,3 @@ let last_segment = path.segments.last().unwrap();

}
_ => Err(format!("can't handle generic argument {:?}", x)),
_ => Err(format!("can't handle generic argument {x:?}")),
})?,

@@ -338,0 +337,0 @@ syn::PathArguments::Parenthesized(_) => {

@@ -126,4 +126,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

return Err(format!(
"Conflicting #[repr(align(...))] type hints {:?} and {:?}.",
old_align, align
"Conflicting #[repr(align(...))] type hints {old_align:?} and {align:?}."
));

@@ -138,7 +137,7 @@ }

Ok(align) => align,
Err(_) => return Err(format!("Non-unsigned #[repr(align({}))].", arg)),
Err(_) => return Err(format!("Non-unsigned #[repr(align({arg}))].")),
};
// Must be a power of 2.
if !align.is_power_of_two() || align == 0 {
return Err(format!("Invalid alignment to #[repr(align({}))].", align));
return Err(format!("Invalid alignment to #[repr(align({align}))]."));
}

@@ -157,5 +156,5 @@ // Only permit a single alignment-setting repr.

(path, arg) => match arg {
None => return Err(format!("Unsupported #[repr({})].", path)),
None => return Err(format!("Unsupported #[repr({path})].")),
Some(arg) => {
return Err(format!("Unsupported #[repr({}({}))].", path, arg));
return Err(format!("Unsupported #[repr({path}({arg}))]."));
}

@@ -170,4 +169,3 @@ },

return Err(format!(
"Conflicting #[repr(...)] type hints {:?} and {:?}.",
old_ty, ty
"Conflicting #[repr(...)] type hints {old_ty:?} and {ty:?}."
));

@@ -174,0 +172,0 @@ }

@@ -87,3 +87,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

out.push(Field {
name: format!("{}", current),
name: format!("{current}"),
ty,

@@ -262,3 +262,3 @@ cfg: Cfg::load(&field.attrs),

out.open_brace();
write!(out, "*this = (*this {} {});", operator, other);
write!(out, "*this = (*this {operator} {other});");
out.new_line();

@@ -265,0 +265,0 @@ write!(out, "return *this;");

@@ -265,3 +265,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

syn::Lit::Char(ref ch) => u32::to_string(&ch.value().into()),
_ => return Err(format!("can't handle const expression {:?}", lit)),
_ => return Err(format!("can't handle const expression {lit:?}")),
};

@@ -275,3 +275,3 @@ Ok(ConstExpr::Value(val))

syn::Expr::Cast(ref cast) => Ok(ConstExpr::load(&cast.expr)?),
_ => Err(format!("can't handle const expression {:?}", expr)),
_ => Err(format!("can't handle const expression {expr:?}")),
}

@@ -464,3 +464,3 @@ }

}
_ => return Err(format!("Unsupported type: {:?}", ty)),
_ => return Err(format!("Unsupported type: {ty:?}")),
};

@@ -707,20 +707,3 @@

if !generic_params.iter().any(|param| param.name() == path) {
if let Some(items) = library.get_items(path) {
if !out.items.contains(path) {
out.items.insert(path.clone());
for item in &items {
item.deref().add_dependencies(library, out);
}
for item in items {
out.order.push(item);
}
}
} else {
warn!(
"Can't find {}. This usually means that this type was incompatible or \
not found.",
path
);
}
out.add(library, path);
}

@@ -844,5 +827,4 @@ }

warn!(
"Cannot find a mangling for generic path {:?}. This usually means that a \
type referenced by this generic was incompatible or not found.",
generic_path
"Cannot find a mangling for generic path {generic_path:?}. This usually means that a \
type referenced by this generic was incompatible or not found."
);

@@ -849,0 +831,0 @@ }

@@ -34,3 +34,3 @@ use crate::bindgen::ir::{

{
write!(out, " {}", note);
write!(out, " {note}");
}

@@ -103,5 +103,5 @@ if let Some(discriminant) = &u.discriminant {

if open {
write!(out, "namespace {} {{", namespace)
write!(out, "namespace {namespace} {{")
} else {
write!(out, "}} // namespace {}", namespace)
write!(out, "}} // namespace {namespace}")
}

@@ -151,3 +151,3 @@ }

// const-ref args to constructor
format!("const& {}", renamed),
format!("const& {renamed}"),
field.ty.clone(),

@@ -168,3 +168,3 @@ )

out.write_vertical_source_list(self, &vec[..], ListType::Join(","), |_, out, s| {
write!(out, "{}", s)
write!(out, "{s}")
});

@@ -199,3 +199,3 @@ out.new_line();

out.new_line();
write!(out, "{}explicit operator bool() const", constexpr_prefix);
write!(out, "{constexpr_prefix}explicit operator bool() const");
out.open_brace();

@@ -253,3 +253,3 @@ write!(out, "return !!{bits};");

out.open_brace();
write!(out, "return {} << \"{{ \"", stream);
write!(out, "return {stream} << \"{{ \"");
let vec: Vec<_> = s

@@ -264,3 +264,3 @@ .fields

ListType::Join(" << \", \""),
|_, out, s| write!(out, "{}", s),
|_, out, s| write!(out, "{s}"),
);

@@ -351,3 +351,3 @@ out.write(" << \" }\";");

if self.config.package_version {
write!(out, "/* Package version: {} */", package_version);
write!(out, "/* Package version: {package_version} */");
out.new_line();

@@ -357,3 +357,3 @@ }

out.new_line_if_not_start();
write!(out, "{}", f);
write!(out, "{f}");
out.new_line();

@@ -363,5 +363,5 @@ }

out.new_line_if_not_start();
write!(out, "#ifndef {}", f);
write!(out, "#ifndef {f}");
out.new_line();
write!(out, "#define {}", f);
write!(out, "#define {f}");
out.new_line();

@@ -385,3 +385,3 @@ }

out.new_line_if_not_start();
write!(out, "{}", f);
write!(out, "{f}");
out.new_line();

@@ -444,3 +444,3 @@ }

for include in self.config.sys_includes() {
write!(out, "#include <{}>", include);
write!(out, "#include <{include}>");
out.new_line();

@@ -450,3 +450,3 @@ }

for include in self.config.includes() {
write!(out, "#include \"{}\"", include);
write!(out, "#include \"{include}\"");
out.new_line();

@@ -456,3 +456,3 @@ }

if let Some(ref line) = self.config.after_includes {
write!(out, "{}", line);
write!(out, "{line}");
out.new_line();

@@ -474,5 +474,5 @@ }

if self.config.language == Language::C {
write!(out, "#endif /* {} */", f);
write!(out, "#endif /* {f} */");
} else {
write!(out, "#endif // {}", f);
write!(out, "#endif // {f}");
}

@@ -584,3 +584,3 @@ out.new_line();

if let Some(ref anno) = self.config.layout.packed {
write!(out, " {}", anno);
write!(out, " {anno}");
}

@@ -590,3 +590,3 @@ }

if let Some(ref anno) = self.config.layout.aligned_n {
write!(out, " {}({})", anno, n);
write!(out, " {anno}({n})");
}

@@ -599,3 +599,3 @@ }

if let Some(ref anno) = self.config.structure.must_use {
write!(out, " {}", anno);
write!(out, " {anno}");
}

@@ -608,3 +608,3 @@ }

{
write!(out, " {}", note);
write!(out, " {note}");
}

@@ -686,3 +686,3 @@

if let Some(ref anno) = self.config.layout.packed {
write!(out, " {}", anno);
write!(out, " {anno}");
}

@@ -692,3 +692,3 @@ }

if let Some(ref anno) = self.config.layout.aligned_n {
write!(out, " {}({})", anno, n);
write!(out, " {anno}({n})");
}

@@ -842,3 +842,3 @@ }

write!(out, "{}", line);
write!(out, "{line}");
out.new_line();

@@ -864,3 +864,3 @@ }

match l {
Literal::Expr(v) => write!(out, "{}", v),
Literal::Expr(v) => write!(out, "{v}"),
Literal::Path {

@@ -872,3 +872,3 @@ ref associated_to,

if let Some(known) = to_known_assoc_constant(path, name) {
return write!(out, "{}", known);
return write!(out, "{known}");
}

@@ -882,5 +882,5 @@ let path_separator = if self.config.language == Language::C {

};
write!(out, "{}{}", export_name, path_separator)
write!(out, "{export_name}{path_separator}")
}
write!(out, "{}", name)
write!(out, "{name}")
}

@@ -893,6 +893,6 @@ Literal::FieldAccess {

self.write_literal(out, base);
write!(out, ").{}", field);
write!(out, ").{field}");
}
Literal::PostfixUnaryOp { op, ref value } => {
write!(out, "{}", op);
write!(out, "{op}");
self.write_literal(out, value);

@@ -907,3 +907,3 @@ }

self.write_literal(out, left);
write!(out, " {} ", op);
write!(out, " {op} ");
self.write_literal(out, right);

@@ -927,5 +927,5 @@ write!(out, ")");

if self.config.language == Language::C {
write!(out, "({})", export_name);
write!(out, "({export_name})");
} else {
write!(out, "{}", export_name);
write!(out, "{export_name}");
}

@@ -950,3 +950,3 @@

// initializers, consider generating them.
write!(out, "/* .{} = */ ", ordered_key);
write!(out, "/* .{ordered_key} = */ ");
self.write_literal(out, &lit.value);

@@ -965,5 +965,5 @@ if i + 1 != ordered_fields.len() {

// initializers, consider generating them.
write!(out, "/* .{} = */ ", ordered_key);
write!(out, "/* .{ordered_key} = */ ");
} else {
write!(out, ".{} = ", ordered_key);
write!(out, ".{ordered_key} = ");
}

@@ -998,3 +998,3 @@ self.write_literal(out, &lit.value);

out.new_line();
write!(out, "using namespace {};", namespace);
write!(out, "using namespace {namespace};");
}

@@ -1001,0 +1001,0 @@ out.new_line();

@@ -47,3 +47,3 @@ use crate::bindgen::ir::{

if self.config.package_version {
write!(out, "''' Package version: {} '''", package_version);
write!(out, "''' Package version: {package_version} '''");
out.new_line();

@@ -53,3 +53,3 @@ }

out.new_line_if_not_start();
write!(out, "{}", f);
write!(out, "{f}");
out.new_line();

@@ -69,3 +69,3 @@ }

out.new_line_if_not_start();
write!(out, "{}", f);
write!(out, "{f}");
out.new_line();

@@ -105,3 +105,3 @@ }

if let Some(ref line) = &self.config.after_includes {
write!(out, "{}", line);
write!(out, "{line}");
out.new_line();

@@ -114,3 +114,3 @@ }

let header = &self.config.cython.header.as_deref().unwrap_or("*");
write!(out, "cdef extern from {}", header);
write!(out, "cdef extern from {header}");
out.open_brace();

@@ -188,3 +188,3 @@ }

if let Some(ref anno) = &self.config.structure.must_use {
write!(out, " {}", anno);
write!(out, " {anno}");
}

@@ -197,3 +197,3 @@ }

{
write!(out, " {}", note);
write!(out, " {note}");
}

@@ -338,3 +338,3 @@

for line in &d.doc_comment[..end] {
write!(out, "#{}", line);
write!(out, "#{line}");
out.new_line();

@@ -349,3 +349,3 @@ }

"false" => write!(out, "False"),
v => write!(out, "{}", v),
v => write!(out, "{v}"),
},

@@ -358,7 +358,7 @@ Literal::Path {

if let Some(known) = to_known_assoc_constant(path, name) {
return write!(out, "{}", known);
return write!(out, "{known}");
}
write!(out, "{}_", export_name)
write!(out, "{export_name}_")
}
write!(out, "{}", name)
write!(out, "{name}")
}

@@ -371,6 +371,6 @@ Literal::FieldAccess {

self.write_literal(out, base);
write!(out, ").{}", field);
write!(out, ").{field}");
}
Literal::PostfixUnaryOp { op, ref value } => {
write!(out, "{}", op);
write!(out, "{op}");
self.write_literal(out, value);

@@ -385,3 +385,3 @@ }

self.write_literal(out, left);
write!(out, " {} ", op);
write!(out, " {op} ");
self.write_literal(out, right);

@@ -401,3 +401,3 @@ write!(out, ")");

} => {
write!(out, "<{}>", export_name);
write!(out, "<{export_name}>");

@@ -404,0 +404,0 @@ write!(out, "{{ ");

@@ -78,3 +78,3 @@ use crate::bindgen::ir::{

if let Some(ref prefix) = prefix {
write!(out, "{}", prefix);
write!(out, "{prefix}");
write_space(layout, out);

@@ -84,3 +84,3 @@ }

if let Some(ref anno) = config.function.must_use {
write!(out, "{}", anno);
write!(out, "{anno}");
write_space(layout, out);

@@ -93,3 +93,3 @@ }

{
write!(out, "{}", note);
write!(out, "{note}");
write_space(layout, out);

@@ -103,3 +103,3 @@ }

write_space(layout, out);
write!(out, "{}", postfix);
write!(out, "{postfix}");
}

@@ -111,3 +111,3 @@ }

// XXX Should this account for `layout`?
write!(out, " {}({})", swift_name_macro, swift_name);
write!(out, " {swift_name_macro}({swift_name})");
}

@@ -228,3 +228,3 @@ }

out.new_line_if_not_start();
write!(out, "{}", f);
write!(out, "{f}");
if !f.ends_with('\n') {

@@ -231,0 +231,0 @@ out.new_line();

@@ -213,5 +213,4 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

warn!(
"Can't transfer annotations from typedef to alias ({}) \
that already has annotations.",
alias_path
"Can't transfer annotations from typedef to alias ({alias_path}) \
that already has annotations."
);

@@ -229,5 +228,4 @@ }

warn!(
"Can't transfer annotations from typedef to alias ({}) \
that already has annotations.",
alias_path
"Can't transfer annotations from typedef to alias ({alias_path}) \
that already has annotations."
);

@@ -245,5 +243,4 @@ }

warn!(
"Can't transfer annotations from typedef to alias ({}) \
that already has annotations.",
alias_path
"Can't transfer annotations from typedef to alias ({alias_path}) \
that already has annotations."
);

@@ -261,5 +258,4 @@ }

warn!(
"Can't transfer annotations from typedef to alias ({}) \
that already has annotations.",
alias_path
"Can't transfer annotations from typedef to alias ({alias_path}) \
that already has annotations."
);

@@ -277,5 +273,4 @@ }

warn!(
"Can't transfer annotations from typedef to alias ({}) \
that already has annotations.",
alias_path
"Can't transfer annotations from typedef to alias ({alias_path}) \
that already has annotations."
);

@@ -282,0 +277,0 @@ }

@@ -134,3 +134,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

if !include.iter().any(|name| name == pkg_name) {
debug!("Excluding crate {}", pkg_name);
debug!("Excluding crate {pkg_name}");
return false;

@@ -614,3 +614,3 @@ }

if !item.abi.is_c() && !item.abi.is_omitted() {
info!("Skip {} - (extern block must be extern C).", crate_name);
info!("Skip {crate_name} - (extern block must be extern C).");
return;

@@ -775,3 +775,3 @@ }

Err(e) => {
warn!("Skipping associated constants for {:?}: {:?}", impl_ty, e);
warn!("Skipping associated constants for {impl_ty:?}: {e:?}");
return;

@@ -789,6 +789,3 @@ }

None => {
warn!(
"Couldn't find path for {:?}, skipping associated constants",
ty
);
warn!("Couldn't find path for {ty:?}, skipping associated constants");
return;

@@ -805,3 +802,3 @@ }

let path = Path::new(item.ident.unraw().to_string());
let path = Path::new(item.ident.unraw().to_string() + impl_path.name());
match Constant::load(

@@ -871,3 +868,3 @@ path,

if !self.constants.try_insert(constant) {
error!("Conflicting name for constant {}", full_name);
error!("Conflicting name for constant {full_name}");
}

@@ -1024,3 +1021,3 @@ }

Err(e) => {
warn!("Failed to parse bitflags invocation: {:?}", e);
warn!("Failed to parse bitflags invocation: {e:?}");
return;

@@ -1027,0 +1024,0 @@ }

@@ -143,3 +143,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

_ => Err(format!("Unrecognized RenameRule: '{}'.", s)),
_ => Err(format!("Unrecognized RenameRule: '{s}'.")),
}

@@ -146,0 +146,0 @@ }

@@ -152,2 +152,15 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

/// Searches for attributes like `#[test = "..."]`.
/// Example:
/// - `item.has_attr_namevalue("test")` => `#[test = "..."]`
fn has_attr_namevalue(&self, name: &str) -> bool {
self.attrs().iter().any(|attr| {
if let syn::Meta::NameValue(nv) = &attr.meta {
nv.path.is_ident(name)
} else {
false
}
})
}
/// Searches for attributes like `#[unsafe(test)]`.

@@ -154,0 +167,0 @@ /// Example:

@@ -199,3 +199,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

pub fn write(&mut self, text: &'static str) {
write!(self, "{}", text);
write!(self, "{text}");
}

@@ -205,3 +205,3 @@

self.line_started = true;
write!(self, "{}", block);
write!(self, "{block}");
}

@@ -230,7 +230,7 @@

if i != items.len() - 1 {
write!(self, "{}", text);
write!(self, "{text}");
}
}
ListType::Cap(text) => {
write!(self, "{}", text);
write!(self, "{text}");
}

@@ -260,7 +260,7 @@ }

if i != items.len() - 1 {
write!(self, "{}", text);
write!(self, "{text}");
}
}
ListType::Cap(text) => {
write!(self, "{}", text);
write!(self, "{text}");
}

@@ -267,0 +267,0 @@ }

@@ -38,3 +38,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

Err(reason) => {
error!("{}", reason);
error!("{reason}");
return;

@@ -73,3 +73,3 @@ }

Err(e) => {
error!("{}", e);
error!("{e}");
return;

@@ -343,3 +343,3 @@ }

Err(msg) => {
error!("{}", msg);
error!("{msg}");
error!("Couldn't generate bindings for {}.", input.display());

@@ -346,0 +346,0 @@ std::process::exit(1);

# This is a template cbindgen.toml file with all of the default values.
# Some values are commented out because their absence is the real default.
#
# See https://github.com/mozilla/cbindgen/blob/master/docs.md#cbindgentoml
# See https://github.com/mozilla/cbindgen/blob/main/docs.md#cbindgentoml
# for detailed documentation of every option here.

@@ -6,0 +6,0 @@

@@ -21,3 +21,3 @@ use std::fs::read_to_string;

let cbindgen_define = format!("-DCBINDGEN_PATH={}", CBINDGEN_PATH);
let cbindgen_define = format!("-DCBINDGEN_PATH={CBINDGEN_PATH}");
cmake_configure

@@ -34,5 +34,3 @@ .arg("-S")

output.status.success(),
"Configuring test project failed: stdout: `{}`, stderr: `{}`",
stdout_str,
stderr_str
"Configuring test project failed: stdout: `{stdout_str}`, stderr: `{stderr_str}`"
);

@@ -51,4 +49,3 @@ let depfile_path = build_dir.join("depfile.d");

output.status.success(),
"Building test project failed: {:?}",
output
"Building test project failed: {output:?}"
);

@@ -58,4 +55,3 @@ let out_str = String::from_utf8(output.stdout).unwrap();

out_str.contains("Running cbindgen"),
"cbindgen rule did not run. Output: {}",
out_str
"cbindgen rule did not run. Output: {out_str}"
);

@@ -98,4 +94,3 @@

output.status.success(),
"Building test project failed: {:?}",
output
"Building test project failed: {output:?}"
);

@@ -102,0 +97,0 @@ let out_str = String::from_utf8(output.stdout).unwrap();

@@ -0,1 +1,8 @@

#if 0
DEF PLATFORM_UNIX = 0
DEF PLATFORM_WIN = 0
#endif
#define PLATFORM_UNIX 1
#include <stdarg.h>

@@ -37,2 +44,8 @@ #include <stdbool.h>

#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
#if defined(PLATFORM_WIN)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 6) }
#endif
#if defined(PLATFORM_UNIX)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 7) }
#endif

@@ -39,0 +52,0 @@ /**

@@ -0,1 +1,8 @@

#if 0
DEF PLATFORM_UNIX = 0
DEF PLATFORM_WIN = 0
#endif
#define PLATFORM_UNIX 1
#include <stdarg.h>

@@ -37,2 +44,8 @@ #include <stdbool.h>

#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
#if defined(PLATFORM_WIN)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 6) }
#endif
#if defined(PLATFORM_UNIX)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 7) }
#endif

@@ -39,0 +52,0 @@ /**

@@ -0,1 +1,8 @@

#if 0
DEF PLATFORM_UNIX = 0
DEF PLATFORM_WIN = 0
#endif
#define PLATFORM_UNIX 1
#include <stdarg.h>

@@ -37,2 +44,8 @@ #include <stdbool.h>

#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
#if defined(PLATFORM_WIN)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 6) }
#endif
#if defined(PLATFORM_UNIX)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 7) }
#endif

@@ -39,0 +52,0 @@ /**

@@ -0,1 +1,8 @@

#if 0
DEF PLATFORM_UNIX = 0
DEF PLATFORM_WIN = 0
#endif
#define PLATFORM_UNIX 1
#include <stdarg.h>

@@ -37,2 +44,8 @@ #include <stdbool.h>

#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
#if defined(PLATFORM_WIN)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 6) }
#endif
#if defined(PLATFORM_UNIX)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 7) }
#endif

@@ -39,0 +52,0 @@ /**

@@ -0,1 +1,8 @@

#if 0
DEF PLATFORM_UNIX = 0
DEF PLATFORM_WIN = 0
#endif
#define PLATFORM_UNIX 1
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t

@@ -27,2 +34,6 @@ from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t

const StyleAlignFlags StyleAlignFlags_MIXED_SELF # = <StyleAlignFlags>{ <uint8_t>(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
IF PLATFORM_WIN:
const StyleAlignFlags StyleAlignFlags_PLATFORM_BIT # = <StyleAlignFlags>{ <uint8_t>(1 << 6) }
IF PLATFORM_UNIX:
const StyleAlignFlags StyleAlignFlags_PLATFORM_BIT # = <StyleAlignFlags>{ <uint8_t>(1 << 7) }

@@ -29,0 +40,0 @@ # An arbitrary identifier for a native (OS compositor) surface

@@ -0,1 +1,8 @@

#if 0
DEF PLATFORM_UNIX = 0
DEF PLATFORM_WIN = 0
#endif
#define PLATFORM_UNIX 1
#include <stdarg.h>

@@ -37,2 +44,8 @@ #include <stdbool.h>

#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
#if defined(PLATFORM_WIN)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 6) }
#endif
#if defined(PLATFORM_UNIX)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 7) }
#endif

@@ -39,0 +52,0 @@ /**

@@ -0,1 +1,8 @@

#if 0
DEF PLATFORM_UNIX = 0
DEF PLATFORM_WIN = 0
#endif
#define PLATFORM_UNIX 1
#include <stdarg.h>

@@ -37,2 +44,8 @@ #include <stdbool.h>

#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
#if defined(PLATFORM_WIN)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 6) }
#endif
#if defined(PLATFORM_UNIX)
#define StyleAlignFlags_PLATFORM_BIT (StyleAlignFlags){ .bits = (uint8_t)(1 << 7) }
#endif

@@ -39,0 +52,0 @@ /**

@@ -0,1 +1,8 @@

#if 0
DEF PLATFORM_UNIX = 0
DEF PLATFORM_WIN = 0
#endif
#define PLATFORM_UNIX 1
#include <cstdarg>

@@ -48,2 +55,8 @@ #include <cstdint>

static const StyleAlignFlags MIXED_SELF;
#if defined(PLATFORM_WIN)
static const StyleAlignFlags PLATFORM_BIT;
#endif
#if defined(PLATFORM_UNIX)
static const StyleAlignFlags PLATFORM_BIT;
#endif
};

@@ -79,2 +92,12 @@ /// 'auto'

};
#if defined(PLATFORM_WIN)
constexpr inline const StyleAlignFlags StyleAlignFlags::PLATFORM_BIT = StyleAlignFlags{
/* .bits = */ (uint8_t)(1 << 6)
};
#endif
#if defined(PLATFORM_UNIX)
constexpr inline const StyleAlignFlags StyleAlignFlags::PLATFORM_BIT = StyleAlignFlags{
/* .bits = */ (uint8_t)(1 << 7)
};
#endif

@@ -81,0 +104,0 @@ /// An arbitrary identifier for a native (OS compositor) surface

@@ -0,1 +1,8 @@

#if 0
DEF PLATFORM_UNIX = 0
DEF PLATFORM_WIN = 0
#endif
#define PLATFORM_UNIX 1
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t

@@ -27,2 +34,6 @@ from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t

const StyleAlignFlags StyleAlignFlags_MIXED_SELF # = <StyleAlignFlags>{ <uint8_t>(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
IF PLATFORM_WIN:
const StyleAlignFlags StyleAlignFlags_PLATFORM_BIT # = <StyleAlignFlags>{ <uint8_t>(1 << 6) }
IF PLATFORM_UNIX:
const StyleAlignFlags StyleAlignFlags_PLATFORM_BIT # = <StyleAlignFlags>{ <uint8_t>(1 << 7) }

@@ -29,0 +40,0 @@ # An arbitrary identifier for a native (OS compositor) surface

@@ -7,2 +7,3 @@ #if 0

#endif
#define PLATFORM_UNIX 1

@@ -15,4 +16,4 @@

#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType {
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType {
A,

@@ -22,7 +23,7 @@ B,

};
typedef uint32_t BarType;
typedef uint32_t FooType;
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType {
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType {
A,

@@ -32,8 +33,29 @@ B,

};
typedef uint32_t FooType;
typedef uint32_t BarType;
#endif
typedef struct Flags {
uint8_t _0;
} Flags;
/**
* none
*/
#define Flags_NONE (Flags){ ._0 = (uint8_t)0 }
#if defined(PLATFORM_WIN)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 0) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 1) }
#endif
#if defined(PLATFORM_WIN)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 3)) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 4)) }
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
typedef struct FooHandle {
FooType ty;
struct Flags flags;
int32_t x;

@@ -40,0 +62,0 @@ float y;

@@ -7,2 +7,3 @@ #if 0

#endif
#define PLATFORM_UNIX 1

@@ -15,4 +16,4 @@

#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType
#ifdef __cplusplus

@@ -27,8 +28,8 @@ : uint32_t

#ifndef __cplusplus
typedef uint32_t BarType;
typedef uint32_t FooType;
#endif // __cplusplus
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType
#ifdef __cplusplus

@@ -43,9 +44,30 @@ : uint32_t

#ifndef __cplusplus
typedef uint32_t FooType;
typedef uint32_t BarType;
#endif // __cplusplus
#endif
typedef struct Flags {
uint8_t _0;
} Flags;
/**
* none
*/
#define Flags_NONE (Flags){ ._0 = (uint8_t)0 }
#if defined(PLATFORM_WIN)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 0) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 1) }
#endif
#if defined(PLATFORM_WIN)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 3)) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 4)) }
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
typedef struct FooHandle {
FooType ty;
struct Flags flags;
int32_t x;

@@ -52,0 +74,0 @@ float y;

@@ -7,2 +7,3 @@ #if 0

#endif
#define PLATFORM_UNIX 1

@@ -15,4 +16,4 @@

#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType {
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType {
A,

@@ -22,7 +23,7 @@ B,

};
typedef uint32_t BarType;
typedef uint32_t FooType;
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType {
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType {
A,

@@ -32,8 +33,29 @@ B,

};
typedef uint32_t FooType;
typedef uint32_t BarType;
#endif
struct Flags {
uint8_t _0;
};
/**
* none
*/
#define Flags_NONE (Flags){ ._0 = (uint8_t)0 }
#if defined(PLATFORM_WIN)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 0) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 1) }
#endif
#if defined(PLATFORM_WIN)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 3)) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 4)) }
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
struct FooHandle {
FooType ty;
struct Flags flags;
int32_t x;

@@ -40,0 +62,0 @@ float y;

@@ -7,2 +7,3 @@ #if 0

#endif
#define PLATFORM_UNIX 1

@@ -15,4 +16,4 @@

#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType
#ifdef __cplusplus

@@ -27,8 +28,8 @@ : uint32_t

#ifndef __cplusplus
typedef uint32_t BarType;
typedef uint32_t FooType;
#endif // __cplusplus
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType
#ifdef __cplusplus

@@ -43,9 +44,30 @@ : uint32_t

#ifndef __cplusplus
typedef uint32_t FooType;
typedef uint32_t BarType;
#endif // __cplusplus
#endif
struct Flags {
uint8_t _0;
};
/**
* none
*/
#define Flags_NONE (Flags){ ._0 = (uint8_t)0 }
#if defined(PLATFORM_WIN)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 0) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 1) }
#endif
#if defined(PLATFORM_WIN)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 3)) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 4)) }
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
struct FooHandle {
FooType ty;
struct Flags flags;
int32_t x;

@@ -52,0 +74,0 @@ float y;

@@ -7,2 +7,3 @@ #if 0

#endif
#define PLATFORM_UNIX 1

@@ -18,3 +19,3 @@

IF (PLATFORM_WIN or M_32):
IF (PLATFORM_UNIX and X11):
cdef enum:

@@ -24,5 +25,5 @@ A,

C,
ctypedef uint32_t BarType;
ctypedef uint32_t FooType;
IF (PLATFORM_UNIX and X11):
IF (PLATFORM_WIN or M_32):
cdef enum:

@@ -32,7 +33,21 @@ A,

C,
ctypedef uint32_t FooType;
ctypedef uint32_t BarType;
cdef struct Flags:
uint8_t _0;
# none
const Flags Flags_NONE # = <Flags>{ <uint8_t>0 }
IF PLATFORM_WIN:
const Flags Flags_A # = <Flags>{ <uint8_t>(1 << 0) }
IF PLATFORM_UNIX:
const Flags Flags_A # = <Flags>{ <uint8_t>(1 << 1) }
IF PLATFORM_WIN:
const Flags Flags_B # = <Flags>{ <uint8_t>((Flags_A)._0 | (1 << 3)) }
IF PLATFORM_UNIX:
const Flags Flags_B # = <Flags>{ <uint8_t>((Flags_A)._0 | (1 << 4)) }
IF (PLATFORM_UNIX and X11):
cdef struct FooHandle:
FooType ty;
Flags flags;
int32_t x;

@@ -39,0 +54,0 @@ float y;

@@ -7,2 +7,3 @@ #if 0

#endif
#define PLATFORM_UNIX 1

@@ -15,4 +16,4 @@

#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType {
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType {
A,

@@ -22,7 +23,7 @@ B,

};
typedef uint32_t BarType;
typedef uint32_t FooType;
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType {
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType {
A,

@@ -32,8 +33,29 @@ B,

};
typedef uint32_t FooType;
typedef uint32_t BarType;
#endif
typedef struct {
uint8_t _0;
} Flags;
/**
* none
*/
#define Flags_NONE (Flags){ ._0 = (uint8_t)0 }
#if defined(PLATFORM_WIN)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 0) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 1) }
#endif
#if defined(PLATFORM_WIN)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 3)) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 4)) }
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
typedef struct {
FooType ty;
Flags flags;
int32_t x;

@@ -40,0 +62,0 @@ float y;

@@ -7,2 +7,3 @@ #if 0

#endif
#define PLATFORM_UNIX 1

@@ -15,4 +16,4 @@

#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType
#ifdef __cplusplus

@@ -27,8 +28,8 @@ : uint32_t

#ifndef __cplusplus
typedef uint32_t BarType;
typedef uint32_t FooType;
#endif // __cplusplus
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType
#ifdef __cplusplus

@@ -43,9 +44,30 @@ : uint32_t

#ifndef __cplusplus
typedef uint32_t FooType;
typedef uint32_t BarType;
#endif // __cplusplus
#endif
typedef struct {
uint8_t _0;
} Flags;
/**
* none
*/
#define Flags_NONE (Flags){ ._0 = (uint8_t)0 }
#if defined(PLATFORM_WIN)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 0) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_A (Flags){ ._0 = (uint8_t)(1 << 1) }
#endif
#if defined(PLATFORM_WIN)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 3)) }
#endif
#if defined(PLATFORM_UNIX)
#define Flags_B (Flags){ ._0 = (uint8_t)((Flags_A)._0 | (1 << 4)) }
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
typedef struct {
FooType ty;
Flags flags;
int32_t x;

@@ -52,0 +74,0 @@ float y;

@@ -7,2 +7,3 @@ #if 0

#endif
#define PLATFORM_UNIX 1

@@ -16,4 +17,4 @@

#if (defined(PLATFORM_WIN) || defined(M_32))
enum class BarType : uint32_t {
#if (defined(PLATFORM_UNIX) && defined(X11))
enum class FooType : uint32_t {
A,

@@ -25,4 +26,4 @@ B,

#if (defined(PLATFORM_UNIX) && defined(X11))
enum class FooType : uint32_t {
#if (defined(PLATFORM_WIN) || defined(M_32))
enum class BarType : uint32_t {
A,

@@ -34,5 +35,68 @@ B,

struct Flags {
uint8_t _0;
constexpr explicit operator bool() const {
return !!_0;
}
constexpr Flags operator~() const {
return Flags { static_cast<decltype(_0)>(~_0) };
}
constexpr Flags operator|(const Flags& other) const {
return Flags { static_cast<decltype(_0)>(this->_0 | other._0) };
}
Flags& operator|=(const Flags& other) {
*this = (*this | other);
return *this;
}
constexpr Flags operator&(const Flags& other) const {
return Flags { static_cast<decltype(_0)>(this->_0 & other._0) };
}
Flags& operator&=(const Flags& other) {
*this = (*this & other);
return *this;
}
constexpr Flags operator^(const Flags& other) const {
return Flags { static_cast<decltype(_0)>(this->_0 ^ other._0) };
}
Flags& operator^=(const Flags& other) {
*this = (*this ^ other);
return *this;
}
bool operator==(const Flags& other) const {
return _0 == other._0;
}
bool operator!=(const Flags& other) const {
return _0 != other._0;
}
};
/// none
constexpr static const Flags Flags_NONE = Flags{
/* ._0 = */ (uint8_t)0
};
#if defined(PLATFORM_WIN)
constexpr static const Flags Flags_A = Flags{
/* ._0 = */ (uint8_t)(1 << 0)
};
#endif
#if defined(PLATFORM_UNIX)
constexpr static const Flags Flags_A = Flags{
/* ._0 = */ (uint8_t)(1 << 1)
};
#endif
#if defined(PLATFORM_WIN)
constexpr static const Flags Flags_B = Flags{
/* ._0 = */ (uint8_t)((Flags_A)._0 | (1 << 3))
};
#endif
#if defined(PLATFORM_UNIX)
constexpr static const Flags Flags_B = Flags{
/* ._0 = */ (uint8_t)((Flags_A)._0 | (1 << 4))
};
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
struct FooHandle {
FooType ty;
Flags flags;
int32_t x;

@@ -43,2 +107,3 @@ float y;

return ty == other.ty &&
flags == other.flags &&
x == other.x &&

@@ -49,2 +114,3 @@ y == other.y;

return ty != other.ty ||
flags != other.flags ||
x != other.x ||

@@ -51,0 +117,0 @@ y != other.y;

@@ -7,2 +7,3 @@ #if 0

#endif
#define PLATFORM_UNIX 1

@@ -18,3 +19,3 @@

IF (PLATFORM_WIN or M_32):
IF (PLATFORM_UNIX and X11):
cdef enum:

@@ -24,5 +25,5 @@ A,

C,
ctypedef uint32_t BarType;
ctypedef uint32_t FooType;
IF (PLATFORM_UNIX and X11):
IF (PLATFORM_WIN or M_32):
cdef enum:

@@ -32,7 +33,21 @@ A,

C,
ctypedef uint32_t FooType;
ctypedef uint32_t BarType;
ctypedef struct Flags:
uint8_t _0;
# none
const Flags Flags_NONE # = <Flags>{ <uint8_t>0 }
IF PLATFORM_WIN:
const Flags Flags_A # = <Flags>{ <uint8_t>(1 << 0) }
IF PLATFORM_UNIX:
const Flags Flags_A # = <Flags>{ <uint8_t>(1 << 1) }
IF PLATFORM_WIN:
const Flags Flags_B # = <Flags>{ <uint8_t>((Flags_A)._0 | (1 << 3)) }
IF PLATFORM_UNIX:
const Flags Flags_B # = <Flags>{ <uint8_t>((Flags_A)._0 | (1 << 4)) }
IF (PLATFORM_UNIX and X11):
ctypedef struct FooHandle:
FooType ty;
Flags flags;
int32_t x;

@@ -39,0 +54,0 @@ float y;

@@ -7,2 +7,7 @@ #include <stdarg.h>

enum UE {
UV,
};
typedef size_t UE;
enum IE {

@@ -13,7 +18,2 @@ IV,

enum UE {
UV,
};
typedef size_t UE;
typedef size_t Usize;

@@ -20,0 +20,0 @@

@@ -7,22 +7,22 @@ #include <stdarg.h>

enum IE
enum UE
#ifdef __cplusplus
: ptrdiff_t
: size_t
#endif // __cplusplus
{
IV,
UV,
};
#ifndef __cplusplus
typedef ptrdiff_t IE;
typedef size_t UE;
#endif // __cplusplus
enum UE
enum IE
#ifdef __cplusplus
: size_t
: ptrdiff_t
#endif // __cplusplus
{
UV,
IV,
};
#ifndef __cplusplus
typedef size_t UE;
typedef ptrdiff_t IE;
#endif // __cplusplus

@@ -29,0 +29,0 @@

@@ -8,2 +8,6 @@ #include <cstdarg>

enum class UE : size_t {
UV,
};
enum class IE : ptrdiff_t {

@@ -13,6 +17,2 @@ IV,

enum class UE : size_t {
UV,
};
using Usize = size_t;

@@ -19,0 +19,0 @@

@@ -10,9 +10,9 @@ from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t

cdef enum:
UV,
ctypedef size_t UE;
cdef enum:
IV,
ctypedef ptrdiff_t IE;
cdef enum:
UV,
ctypedef size_t UE;
ctypedef size_t Usize;

@@ -19,0 +19,0 @@

@@ -21,2 +21,6 @@ bitflags! {

const MIXED_SELF = 1 << 5 | AlignFlags::FLEX_START.bits | AlignFlags::END.bits;
#[cfg(windows)]
const PLATFORM_BIT = 1 << 6;
#[cfg(unix)]
const PLATFORM_BIT = 1 << 7;
}

@@ -23,0 +27,0 @@ }

@@ -0,1 +1,9 @@

header = """
#if 0
DEF PLATFORM_UNIX = 0
DEF PLATFORM_WIN = 0
#endif
#define PLATFORM_UNIX 1
"""
[struct]

@@ -12,1 +20,5 @@ associated_constants_in_body = true

allow_constexpr = true
[defines]
"unix" = "PLATFORM_UNIX"
"windows" = "PLATFORM_WIN"

@@ -9,2 +9,21 @@ #[cfg(all(unix, x11))]

#[repr(C)]
pub struct Flags(u8);
bitflags! {
impl Flags: u8 {
/// none
const NONE = 0;
#[cfg(windows)]
const A = 1 << 0;
#[cfg(unix)]
const A = 1 << 1;
#[cfg(windows)]
const B = Self::A.bits() | (1 << 3);
#[cfg(unix)]
const B = Self::A.bits() | (1 << 4);
}
}
#[cfg(all(unix, x11))]

@@ -14,2 +33,3 @@ #[repr(C)]

ty: FooType,
flags: Flags,
x: i32,

@@ -16,0 +36,0 @@ y: f32,

@@ -8,2 +8,3 @@ header = """

#endif
#define PLATFORM_UNIX 1
"""

@@ -27,1 +28,4 @@

derive_neq = true
[macro_expansion]
bitflags = true

@@ -42,3 +42,3 @@ extern crate cbindgen;

assert!(
!output.is_none() || !(generate_depfile || generate_symfile),
output.is_some() || !(generate_depfile || generate_symfile),
"generating a depfile or symfile requires outputting to a path"

@@ -97,3 +97,3 @@ );

println!("Running: {:?}", command);
println!("Running: {command:?}");
let cbindgen_output = command.output().expect("failed to execute process");

@@ -120,3 +120,4 @@

fn read_to_string(f: NamedTempFile) -> String {
std::fs::read_to_string(&f).expect(&format!("Failed to read file as String: {:?}", f))
std::fs::read_to_string(&f)
.unwrap_or_else(|_| panic!("Failed to read file as String: {f:?}"))
}

@@ -140,2 +141,3 @@ let depfile_content = depfile.map(read_to_string);

skip_warning_as_error: bool,
cpp_compat: bool,
) {

@@ -194,2 +196,6 @@ let cc = match language {

if cpp_compat {
command.arg("-D").arg("CBINDGEN_CPP_COMPAT");
}
command.arg("-o").arg(&object);

@@ -211,5 +217,5 @@ command.arg("-c").arg(cbindgen_output);

println!("Running: {:?}", command);
println!("Running: {command:?}");
let out = command.output().expect("failed to compile");
assert!(out.status.success(), "Output failed to compile: {:?}", out);
assert!(out.status.success(), "Output failed to compile: {out:?}");

@@ -266,3 +272,3 @@ if object.exists() {

let source_file =
format!("{}{}{}", name, style_ext, lang_ext).replace(SKIP_WARNING_AS_ERROR_SUFFIX, "");
format!("{name}{style_ext}{lang_ext}").replace(SKIP_WARNING_AS_ERROR_SUFFIX, "");
let symbols_file = format!("{source_file}.sym");

@@ -308,5 +314,3 @@

sources.contains(path.to_str().unwrap()),
"Path: {:?}, Depfile contents: {}",
path,
depfile
"Path: {path:?}, Depfile contents: {depfile}"
);

@@ -351,2 +355,3 @@ assert_eq!(rules.count(), 0, "More than 1 rule in the depfile");

skip_warning_as_error,
cpp_compat,
);

@@ -362,2 +367,3 @@

skip_warning_as_error,
cpp_compat,
);

@@ -364,0 +370,0 @@ }

# Specify the minimum supported Rust version
msrv = "1.70"

Sorry, the diff of this file is not supported yet