First start by using .parse_args()? to parse a bunch of FunctionAttr using a new type wrapper struct RawFuncAttrs(syn::punctuated::Punctuated::<FunctionAttr, syn::Token![,]>);
Then combine them all using something like: FunctionAttributes::from_raw(attributes: &[RawFuncAttrs]).
Potential Solution 2 - Make the user specify all attributes together
Don't allow multiple separate #[swift_bridge(..)] attributes and instead make the user say #[swift_bridge(init, associated_to = Foo)] if they want to express multiple properties.
Potential Solution 3 - ...
Trying to quickly open this issue and go do something else so I didn't think of all possible solutions.
If two
#[swift_bridge(..)]
attributes are used on the same funtion the first one will get ignored.This is ignoring of the first
#[swift_bridge(..)]
attribute is happening here https://github.com/chinedufn/swift-bridge/blob/1b797f6595c9e45f30032db5a24403f746f5d1b0/crates/swift-bridge-ir/src/parse/parse_extern_mod.rs#L97-L102Potential Solutions
Potential Solution 1 - Merge function attributes
First start by using
.parse_args()?
to parse a bunch ofFunctionAttr
using a new type wrapperstruct RawFuncAttrs(syn::punctuated::Punctuated::<FunctionAttr, syn::Token![,]>)
;Then combine them all using something like:
FunctionAttributes::from_raw(attributes: &[RawFuncAttrs])
.https://github.com/chinedufn/swift-bridge/blob/1b797f6595c9e45f30032db5a24403f746f5d1b0/crates/swift-bridge-ir/src/parse/parse_extern_mod/function_attributes.rs#L67-L68
RawFuncAttrs
would look similar to this https://github.com/chinedufn/swift-bridge/blob/1b797f6595c9e45f30032db5a24403f746f5d1b0/crates/swift-bridge-ir/src/parse/parse_extern_mod/function_attributes.rs#L63-L76Potential Solution 2 - Make the user specify all attributes together
Don't allow multiple separate
#[swift_bridge(..)]
attributes and instead make the user say#[swift_bridge(init, associated_to = Foo)]
if they want to express multiple properties.Potential Solution 3 - ...
Trying to quickly open this issue and go do something else so I didn't think of all possible solutions.