Skip to content

0.1.50

Compare
Choose a tag to compare
@chinedufn chinedufn released this 20 Feb 18:06
· 52 commits to master since this release
8c7d1a3
  • Support data-carrying tuple enum variants. #172 (thanks @NiwakaDev)

    // For example, the following is now possible:
    
    #[swift_bridge::bridge]
    mod ffi {
        enum EnumWithUnnamedData {
            Variant1(String, u32),
            Variant2(i32, u8),
            Variant3,
        }
    }   
    // Swift
    
    let myEnum: EnumWithUnnamedData = .Variant2(10, 20)
  • Emit compile time errors when returning the wrong opaque Rust type. #169 (thanks @MikuroXina)

    // For example, the following will no longer compile:
    
    #[swift_bridge::bridge]
    mod ffi {
        extern "Rust" {
            // Before this release calling `get_reference()` from Swift would cause
            // undefined behavior.
            // As of this release this will no longer compile.
            fn get_reference() -> SomeType;
        }
    }
    
    // Note that the bridge module incorrectly declares `-> SomeType`
    // instead of `-> &'static SomeType`.
    fn get_reference() -> &'static SomeType {
        &SomeType
    }