Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azriel91/assoc_type_params
Experiment using single type with associated types to track type params.
https://github.com/azriel91/assoc_type_params
Last synced: about 1 month ago
JSON representation
Experiment using single type with associated types to track type params.
- Host: GitHub
- URL: https://github.com/azriel91/assoc_type_params
- Owner: azriel91
- Created: 2024-01-10T07:27:29.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-11T03:42:00.000Z (12 months ago)
- Last Synced: 2024-10-14T02:48:07.650Z (2 months ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Assoc Type Params
Experiment using single type with associated types to track type params.
Instead of:
```rust
struct CmdCtx {
input: Input,
output: Output,
marker: std::marker::PhantomData,
}fn borrows_cmd_ctx(
ctx: &mut CmdCtx,
// other params
) -> Result<(), Error> {
todo!()
}fn pass_cmd_ctx_around(
cmd_ctx: &mut CmdCtx,
) {
todo!()
}
```We want something like:
```rust
struct CmdCtx {
input: Types::Input,
output: Types::Output,
}fn borrows_cmd_ctx(
ctx: &mut CmdCtx,
// other params
) -> Result<(), Types::Error> {
todo!()
}fn pass_cmd_ctx_around(
cmd_ctx: &mut CmdCtx,
) {
todo!()
}
```