Skip to content

Commit 1474e09

Browse files
authored
docs: add more comparisons with similar crates (#16)
1 parent 001400d commit 1474e09

File tree

4 files changed

+41
-17
lines changed

4 files changed

+41
-17
lines changed

.github/workflows/cicd.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,38 +152,40 @@ jobs:
152152
commit_user_email: github-actions[bot]@users.noreply.github.com
153153
commit_author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
154154

155+
# How to create a new GitHub release?
156+
# 1. Create a release branch named "release/<tag>".
157+
# 2. Open a PR from the branch, including the release note in the PR body.
158+
# 3. Wait for the CI to create a draft release.
159+
# 4. Publish the release when it's ready.
155160
release:
156161
name: Create GitHub release
157162
needs: [check, changelog]
158-
if: startsWith(github.head_ref, 'release/')
163+
if: startsWith(github.head_ref, 'release/') && github.repository == 'loichyan/dynify'
159164
permissions:
160-
contents: write # Need to update release
165+
contents: write # need to update release
161166
runs-on: ubuntu-latest
162167
steps:
163168
- name: Setup | Checkout
164169
uses: actions/checkout@v4
165170

166-
# For a PR from "release/v1.0.0", the release tag is set to "v1.0.0"
167171
- name: Setup | Configure
168172
id: configure
169173
run: echo tag="${GITHUB_HEAD_REF#release/}" >$GITHUB_OUTPUT
170174

171-
# Release notes are taken from the PR's body
172175
- name: Release | Create Release
173176
env:
174177
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
175178
release_tag: ${{ steps.configure.outputs.tag }}
176179
release_body: ${{ github.event.pull_request.body }}
177180
run: |
178-
if gh release view "$release_tag" &>/dev/null; then
179-
echo "update existed release $release_tag"
180-
command=edit
181+
if gh release view "$release_tag" >/dev/null; then
182+
echo "update existing release $release_tag"
183+
gh release edit "$release_tag" --notes="$release_body"
181184
else
182185
echo "create new release $release_tag"
183-
command=create
186+
gh release create "$release_tag" \
187+
--target="$GITHUB_BASE_REF" \
188+
--draft=true \
189+
--title="${release_tag#v} ($(date -u +'%Y-%m-%d'))" \
190+
--notes="$release_body"
184191
fi
185-
gh release "$command" "$release_tag" \
186-
--target="$GITHUB_BASE_REF" \
187-
--draft=true \
188-
--title="$release_tag ($(date -u +'%Y-%m-%d'))" \
189-
--notes="$release_body"

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ changes.
9090
[README](https://github.com/loichyan/dynify/blob/v0.0.1/README.md) for more
9191
details.
9292

93-
[0.0.1]: https://github.com/loichyan/dynify/releases/tag/v0.0.1
94-
[0.1.0]: https://github.com/loichyan/dynify/releases/tag/v0.1.0
95-
[0.1.1]: https://github.com/loichyan/dynify/releases/tag/v0.1.1
93+
[0.0.1]: https://github.com/loichyan/dynify/tree/v0.0.1
94+
[0.1.0]: https://github.com/loichyan/dynify/compare/v0.0.1..v0.1.0
95+
[0.1.1]: https://github.com/loichyan/dynify/compare/v0.1.0..v0.1.1
9696
[Unreleased]: https://github.com/loichyan/dynify/compare/v0.1.1..HEAD

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ for limited environments. In contrast, async-trait requires heap allocation to
6565
store trait objects, as it essentially transforms `async fn` into
6666
`Box<dyn Future>`.
6767

68+
### vs dynosaur
69+
70+
[dynosaur](https://crates.io/crates/dynosaur) employs the same approach as
71+
async-trait to generate dyn compatible traits but, by default, preserves the
72+
original trait for more performant static dispatch. Similar to the async-trait
73+
case, the main advantage of using dynify is the possibility to achieve heapless
74+
dynamic dispatch.
75+
6876
## ♥️ Special thanks
6977

7078
- [Rust-for-Linux/pin-init](https://github.com/Rust-for-Linux/pin-init) for its

src/dynify.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ trait DynTrait {
111111
In common cases, you can rely on the lifetimes generated by `#[dynify]`, adding
112112
extra bounds as needed.
113113

114-
## Making [`Send`]able generated traits
114+
## Making generated traits [`Send`]able
115115

116116
Unlike `async-trait`, this macro does not provide support for adding `Send`
117117
bounds to returned `Future`s (or any other `impl Trait`s). However, as
@@ -136,3 +136,17 @@ fn run_client(
136136
}
137137
}
138138
```
139+
140+
As an alternative, you can also [bitte](https://crates.io/crates/bitte) for this
141+
purpose:
142+
143+
<!-- TODO: enable doctest after we move to edition 2024 -->
144+
145+
```rust,ignore
146+
# use dynify::PinDynify;
147+
#[bitte::bitte(Send)]
148+
#[dynify::dynify] // must be put within the scope of `#[bitte]`
149+
trait Client {
150+
async fn request(&self, uri: &str) -> String;
151+
}
152+
```

0 commit comments

Comments
 (0)