Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Rust returning -> Result<_, String> #296

Merged
merged 3 commits into from
Oct 14, 2024

Conversation

brittlewis12
Copy link
Contributor

@brittlewis12 brittlewis12 commented Oct 14, 2024

Support Rust returning -> Result<_, String>, e.g.:

#[swift_bridge::bridge]
mod ffi {
    extern "Rust" {
        fn do_fallible_work() -> Result<(), String>;
    }
}

Incorporate the changes from #282 to implement swift's Error protocol for ruststring, & extend them with the tests requested in #295 (comment)


thanks for your work on this lovely crate!

Copy link
Owner

@chinedufn chinedufn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Minor feedback, then we can land this. Thank you for working on this.

@chinedufn
Copy link
Owner

Please update your PR body with an example of a simple bridge module that is now possible.

This example will be used in the release notes.

Can just be a bridge module with a simple function that returns -> Result<String, String>

@chinedufn chinedufn changed the title enable interfaces which return Result<_, String> Support Rust returning -> Result<_, String> Oct 14, 2024
* document relationships between impl & tests
@chinedufn
Copy link
Owner

Looks great. Thank you for your first contribution. I'll merge once tests pass.

@chinedufn chinedufn merged commit c45a38c into chinedufn:master Oct 14, 2024
5 checks passed
@brittlewis12 brittlewis12 deleted the string-error branch October 14, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants