Skip to content

Releases: dtolnay/cxx

1.0.14

10 Dec 20:30
1.0.14
a7b2b30

Choose a tag to compare

  • Support Vec<T> where T is a shared struct from a different bridge module (#535)
  • Support explicit impls impl Vec<T> {} and impl Box<T> {} (#542, #555)
  • Fix missing imports when generating C++ std::hash template specialization via #[derive(Hash)] (#556, #557)
  • Respect class-specific member operator new in the implementation of UniquePtr::new (#553)
  • Support reuse of non-POD shared types by value across bridge modules (#551, #559, #560)

1.0.13

10 Dec 20:24
1.0.13
c9e14fb

Choose a tag to compare

  • Fix a unique_ptr import in bridge modules that involve CxxVector but not UniquePtr (#548)

1.0.12

04 Dec 20:55
1.0.12
56f78f3

Choose a tag to compare

  • impl Debug for CxxVector<T> (#540)

  • Support parsing empty value for namespace attribute

    #[cxx::bridge(namespace = "some::path")]
    mod ffi {
        #[namespace = ""]
        struct InGlobalNamespace {...}  // exposed at ::InGlobalNamespace
    
        // everything else would be under ::some::path
    }

1.0.11

03 Dec 20:33
1.0.11
7297d74

Choose a tag to compare

  • Upgrade rust::Vec<T>'s iterator category from "forward iterator" to "random access iterator" to allow sorting and other random iteration (#538, thanks @mindv0rtex)

1.0.10

02 Dec 18:41
1.0.10
e58f3a0

Choose a tag to compare

  • Add cxx::SharedPtr<T>, a binding for C++ std::shared_ptr (#536)

1.0.9

01 Dec 23:05
1.0.9
9bbbe5f

Choose a tag to compare

  • Support derive(PartialOrd, Ord) on shared enums

  • Add non-const indexing overloads for rust::Vec<T> in C++: https://cxx.rs/binding/vec.html

      const T &operator[](size_t n) const noexcept;
      const T &at(size_t n) const;
      const T &front() const;
      const T &back() const;
    
    + T &operator[](size_t n) noexcept;
    + T &at(size_t n);
    + T &front();
    + T &back();

1.0.8

30 Nov 08:24
1.0.8
0b933de

Choose a tag to compare

  • Add comparison operators (==, !=, <, <=, >, >=) on rust::Str and rust::String (#531)

  • Add a constructor for rust::Vec<T> taking a std::initializer_list<T> (#533)

    rust::Vec<rust::String> vec = {"good", "stuff"};

1.0.7

29 Nov 22:59
1.0.7
45e4a80

Choose a tag to compare

  • Allow associated methods of the same name on different types in the same bridge (#471)

1.0.6

28 Nov 02:44
1.0.6
ecce017

Choose a tag to compare

  • Connect standard library derives on shared types to C++ operator overloads (#518, #519, #520, #521, #522)
    • derive(PartialEq) on the Rust side turns into C++ operator== and operator!=
    • derive(PartialOrd) turns into operator<, operator<=, operator>, operator>=
    • derive(Hash) turns into a specialization of template <> struct std::hash<T>
#[cxx::bridge]
mod ffi {
    #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Debug)]
    struct AllTheDerives {
        x: i32,
        y: i32,
    }
}
// generated

struct AllTheDerives final {
  int32_t x;
  int32_t y;

  bool operator==(const AllTheDerives &) const noexcept;
  bool operator!=(const AllTheDerives &) const noexcept;
  bool operator<(const AllTheDerives &) const noexcept;
  bool operator<=(const AllTheDerives &) const noexcept;
  bool operator>(const AllTheDerives &) const noexcept;
  bool operator>=(const AllTheDerives &) const noexcept;
};

namespace std {
  template <> struct hash<AllTheDerives> {
    size_t operator()(const AllTheDerives &self) const noexcept;
  };
}

1.0.5

26 Nov 05:33
1.0.5
1c534cf

Choose a tag to compare

  • Add mutable iterators for rust::Vec<T> in C++ (#509)

      class Vec<T> {
    +   class iterator;
    +   iterator begin() noexcept;
    +   iterator end() noexcept;
    
        class const_iterator;
        const_iterator begin() const noexcept;
        const_iterator end() const noexcept;
    +   const_iterator cbegin() const noexcept;
    +   const_iterator cend() const noexcept;
      };
  • Support slices with arbitrary element type (previously restricted to u8) (#514)

  • Add c_char type which refers to std::os::raw::c_char in Rust and char in C++ (#515)

  • Add iterator for rust::Slice<T> and rust::Slice<const T> (#516)

      class Slice<T> {
    +   class iterator;
    +   iterator begin() const noexcept;
    +   iterator end() const noexcept;
      };
  • Add iterators for rust::String and rust::Str (#517)

      class String {
    +   using iterator = char *;
    +   iterator begin() noexcept;
    +   iterator end() noexcept;
    
    +   using const_iterator = const char *;
    +   const_iterator begin() const noexcept;
    +   const_iterator end() const noexcept;
    +   const_iterator cbegin() const noexcept;
    +   const_iterator cend() const noexcept;
      };
    
      class Str {
    +   using iterator = const char *;
    +   using const_iterator = const char *;
    +   const_iterator begin() const noexcept;
    +   const_iterator end() const noexcept;
    +   const_iterator cbegin() const noexcept;
    +   const_iterator cend() const noexcept;
      };