Skip to content

1.0.26

Compare
Choose a tag to compare
@dtolnay dtolnay released this 03 Jan 20:24
· 1527 commits to master since this release
1.0.26
a0df097
  • Support lifetimes on extern types (#610, #611, #622, #624, #627, #628, #630, #634, #635, #652, #653)

    #[cxx::bridge]
    mod ffi {
        unsafe extern "C++" {
            type Resource;
            type Holder<'a>;  // contains a `const Resource &`
    
            fn makeHolder<'a>(resource: &'a Resource) -> SharedPtr<Holder<'a>>;
    
            // or with lifetime elision
            fn makeHolder(resource: &Resource) -> SharedPtr<Holder>;
        }
    }
  • Support lifetimes on shared structs (#650)

    #[cxx::bridge]
    mod ffi {
        struct Example<'a> {
            s: &'a str,
            x: &'a [UniquePtr<Thing<'a>>],
        }
    }
  • Support &str and &[T] as element type of slices and arrays (#636, #638, #644, #645, #647, #651)

    mod ffi {
        extern "Rust" {
            fn demo(flags: &[&str]);
        }
    }
  • Support #[rust_name = "..."] and #[cxx_name = "..."] attributes on fields of shared structs (#631, #632)

    #[cxx::bridge]
    mod ffi {
        struct Example {
            #[cxx_name = "type"]  // `type` is a keyword in Rust, but not C++
            ty: Type,
        }
    }
  • Provide swap() const member functions for the types in cxx.h (#642, #643, #646, thanks @capickett)

  • Clean up warnings in generated code on various platforms (#637, #639, #640, #648, #649)