Skip to content

Implement to_alpha_numeric_underscore_name for all StdLibType variants - #371

Open
finn-devs wants to merge 1 commit into
chinedufn:masterfrom
finn-devs:main
Open

Implement to_alpha_numeric_underscore_name for all StdLibType variants#371
finn-devs wants to merge 1 commit into
chinedufn:masterfrom
finn-devs:main

Conversation

@finn-devs

Copy link
Copy Markdown

The to_alpha_numeric_underscore_name method on StdLibType had a catch-all _ => todo!() arm that panicked at runtime when generating code for Result return types containing certain stdlib types (e.g. Result<Vec<u8>, String>).

This replaces the catch-all with explicit implementations for the remaining variants:

  • U64"U64"
  • I64"I64"
  • Str"Str"
  • Vec"Vec"
  • Option"Option"
  • RefSlice"RefSlice"
  • Pointer"Pointer"

BoxedFnOnce is left as a labeled todo!("BoxedFnOnce in alpha_numeric name") since I don't have a use case to test against.

Changes: crates/swift-bridge-ir/src/bridged_type.rs (+22 lines, -1 line)

The catch-all todo!() panicked when generating Swift code for bridge
declarations using Option, Vec, RefSlice, Pointer, Str, U64, or I64
inside Result return types.
@finn-devs

Copy link
Copy Markdown
Author

Hi, I forked this repo and made these changes for my project, and thought others could find them useful

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.

1 participant