Replace args_into
function attribute with into
argument attribute.
#234
Labels
good first issue
Good for newcomers
Right now users can use the
args_into
attribute on anextern "Rust"
function in order to convert the type passed in from Swift into a different Rust type.swift-bridge/book/src/bridge-module/functions/README.md
Lines 107 to 144 in 2724644
We want to instead use an attribute on the function's arguments, like we do for the
#[swift_bridge(label = "...")]
attribute.swift-bridge/book/src/bridge-module/functions/README.md
Lines 264 to 290 in 2724644
So, we want to be able to write a bridge module that looks like this:
This should largely come down to looking at the
#[swift_bridge(label = "...")]
implementation and doing the same thing for a new#[swift_bridge(into)]
function argument attribute.Potentially Helpful Resources
Argument labels implementation
Here's the PR that implemented the
#[swift_bridge(label = "...")]
function attribute:https://github.com/chinedufn/swift-bridge/pull/156/files
Parsing
Here's where we currently parse the
args_into
attribute:swift-bridge/crates/swift-bridge-ir/src/parse/parse_extern_mod/function_attributes.rs
Lines 112 to 120 in 1b797f6
Here's where we currently parse the
label
attribute:swift-bridge/crates/swift-bridge-ir/src/parse/parse_extern_mod/argument_attributes.rs
Lines 32 to 40 in 3c0d00d
swift-bridge/crates/swift-bridge-ir/src/parse/parse_extern_mod/argument_attributes.rs
Lines 58 to 80 in 3c0d00d
Codegen Test
Here's the argument label codegen test:
swift-bridge/crates/swift-bridge-ir/src/codegen/codegen_tests/argument_label_codegen_tests.rs
Lines 5 to 7 in 3c0d00d
Here's the current args_into codegen test:
swift-bridge/crates/swift-bridge-ir/src/codegen/codegen_tests/function_attribute_codegen_tests.rs
Lines 5 to 6 in c15ba30
Integration test
Here's the argument label integration test:
swift-bridge/SwiftRustIntegrationTestRunner/SwiftRustIntegrationTestRunnerTests/ArgumentAttributesTest.swift
Lines 16 to 19 in 3c0d00d
Here's the current args_into integration test:
swift-bridge/crates/swift-integration-tests/src/function_attributes/args_into.rs
Lines 13 to 21 in 56fbe5c
The text was updated successfully, but these errors were encountered: