googlefonts / googlefonts/fontations

Simpler read/write conversions?

Open
#723 0 comments 1 reaction 0 assignees View on GitHub
codegen enhancement
Dominant language
Rust
Stars
826
Forks
75
Avg merge
22h 33m
Merged PRs (30d)
75

Description

We currently have a mechanism for converting between read/write types, modelled after `TryFrom`/`TryInto`, but it is likely that this mechanism could be improved:

- it does not seem to be implemented for records
- It should be possible to implement `From/Into` directly in some cases?
- It would also be nice if this trait had an associated type instead of a generic param, e.g. if it looked like,

```rust
ToOwnedTable {
type Owned;
fn to_owned_table(&self) -> Self::Owned;
}
```

because then you would not need to name the target type. I believe I tried this originally, and one of the issues was having the types declared in separate crates, and running into problems with the orphan rules?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the existing read/write conversion traits and their implementations, then check how records and types in separate crates are handled. Compare the current generic-parameter design with associated types and direct From/Into implementations, including orphan-rule constraints; done requires an agreed design and documented scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.