Skip to content

0.1.56

Compare
Choose a tag to compare
@chinedufn chinedufn released this 08 Aug 09:34
· 7 commits to master since this release
d2c09e2
  • Add swift-bridge parse-bridges CLI command. #274 (thanks @integer-overflown)

    swift-bridge-cli parse-bridges --crate-name my-crate -f src/lib.rs -o generated
    swift-bridge-cli parse-bridges --crate-name my-superb-crate \
      -f src/lib.rs \
      -f src/some_other_file.rs \
      -o generated
  • Respect bridge modules' visibility. #284 (thanks @jnbooth)

    // Notice that this is `pub mod`.
    // Before this commit `swift-bridge` would ignore the `pub` and instead
    // emit a `mod ffi`.
    // This made it impossible to `use enums::ffi_foo::MyEnum` from another module.
    #[swift_bridge::bridge]
    pub mod ffi_foo {
        enum MyEnum {
            VariantA,
            VariantB,
            VariantC,
        }
    }
    
    #[swift_bridge::bridge]
    pub(crate) mod ffi_bar {
        enum AnotherEnum {
            Variant1,
            Variant2,
        }
    }
  • Add a temporary work around for a dead code linting regression in Rust 1.79. #278 (thanks @sax)

    • rustc's dead code linting pass regressed in 1.79, causing swift-bridge to sometimes generate code that emitted dead code warnings, even though the code was not dead.
      // Some bridge modules that used `Result` were given an
      // "error: field `0` is never read" warning.
      #[swift_bridge::bridge]
      mod ffi {
          #[swift_bridge(swift_repr = "struct")]
          struct TransparentErrorStruct(pub String);
      
          extern "Rust" {
              fn rust_func_returns_result_transparent_struct(
                  succeed: bool
              ) -> Result<(), TransparentErrorStruct>;
          }
      }