Comments (2)
I was going to recommend this feature! Could be a nice quality of life improvement.
from swift-bridge.
Here's a good-first-issue
guide on how to implement this feature.
Implementation Guide
Background Reading
We already parse doc comments for opaque types. Parsing doc comments on functions should work similarly.
swift-bridge/crates/swift-bridge-ir/src/parse/parse_extern_mod.rs
Lines 886 to 912 in 3c0d00d
Implementing for Functions
Doc Attribute
Add a FunctionAttributes.doc_comment: Option<String>
Add a FunctionAttribute::Doc(String)
Parser Test
Add a parser test verifying that we can parse doc comments on a function in an extern "Rust"
block.
Our test can use a multi-line doc comment.
Here's an example of a parser test that we can use as inspiration for this new test:
We can pass the test by parsing the doc comment somewhere around here
Codegen Test
Add a function attribute codegen test where we test that we emit a doc comment on the generated Swift function.
We can use ExpectedRustTokens::SkipTest
since we're mainly concerned with the generated Swift code.
We should use a multi line doc comment in our test.
Here's an example of a function attribute codegen test. Our doc comment test can live near here.
Pass Tests
Once the parser and codegen tests are passing we can consider this issue complete.
from swift-bridge.
Related Issues (20)
- swift-bridge-build should not emit errors and instead let rustc show errors emitted by the procedural macro HOT 2
- Problem with x86_64-apple-ios-simulator HOT 2
- Add RustVec.intoArray() HOT 1
- SwiftData struct for translating Swift's Data class HOT 1
- extern Swift declaration not public HOT 12
- Support Box<FnOnce> in extern "Rust" HOT 3
- Xcode reports "Multiple commands produce '...DerivedData...Build/Products/Debug/include/module.modulemap'" HOT 3
- Clippy finds clippy::unnecessary-cast
- Getting these errors in my project HOT 1
- Add an additional XCode + Rust project option HOT 1
- Building for Release HOT 5
- #[swift_bridge::bridge] macro forces module to be private HOT 2
- warning: `extern` block uses type `RustString`, which is not FFI-safe HOT 4
- Book update: Xcode 15 (at least) requires a bridge in order to import into swift
- Can't seem to return refs of custom types HOT 11
- Cannot use two `#[swift_bridge(..)]` attributes on the same function
- Already_declared causes swift generation to never declare Class HOT 1
- Result returns translating incorrectly? HOT 3
- Is &Vec<T> supported? HOT 2
- Cannot for the life of me get Xcode + Cargo to work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-bridge.