Support fallible Fill conversions that use sibling DTO fields
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Read the Fill derive implementation and its generated field assignment hook, then reproduce the type boundary with the issue’s ContactInput example using database-sqlite and cargo check. The issue asks whether a fallible DTO-to-model mapping hook is in scope, without specifying its API or behavior; a maintainer decision is needed before implementation can be scoped.
Written by the indexing model from the issue text.
Description
In Laravel for Rust 0.2.0, a form DTO can derive Fill when its values already fit the model column types. A DTO sometimes needs a fallible conversion that reads a sibling field. For example, a national phone number needs the submitted region before it can be written as canonical text.
With the database-sqlite feature, this minimal example reproduces the type boundary:
use laravel::model::{Fill, model};
#[model]
struct Contact {
id: i64,
phone: String,
region: String,
}
struct SubmittedPhone(String);
#[derive(Fill)]
#[fills(Contact)]
struct ContactInput {
phone: SubmittedPhone,
region: String,
}
cargo check reports error[E0277]: a SubmittedPhone can't fill a std::string::String column and says FillValue<std::string::String> is not implemented for SubmittedPhone. The current Fill derive forwards each field independently, and its assignment hook has no error return. An infallible conversion from the field alone cannot use the sibling region.
An application can normalize first and call the model's typed setter. Would a fallible DTO-to-model mapping hook be in scope for the framework? A hook taking the DTO and returning a typed column value would let applications reuse the rest of the generated field mapping while propagating conversion errors.
- Dominant language
- Rust
- Stars
- 847
- Forks
- 174
- Avg merge
- 5h 40m
- Merged PRs (30d)
- 167
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from laravel/rust-framework
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
laravel/rust-framework#864 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
laravel/rust-framework#876 ·
Maintainers usually reply within 1 day
-
Case-sensitive contains, starts_with and ends_with that match % and _ literally on every databaseOpen
Difficulty 4/5 3-5 days Newbie friendliness 58/100
laravel/rust-framework#874 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
laravel/rust-framework#873 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
laravel/rust-framework#872 ·
Maintainers usually reply within 1 day
All issues in laravel/rust-framework
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
neuralmagic/crucible#579 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
eclipse-score/kyron#249 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
seanmonstar/reqwest#3157 ·
Maintainers usually reply within 2 days