Skip to content

FromTvf, ToTvf, and IntoTvf derive macros - #91

Open
oschijns wants to merge 17 commits into
mainfrom
derive-macro
Open

oschijns wants to merge 17 commits into
mainfrom
derive-macro

Conversation

@oschijns

@oschijns oschijns commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Introduce ToTvf and FromTvf derive macros to serialize and deserialize Rust structs and enums from TVF messages. This simplify defining exchange protocols as we can simply declare messages as structure and let the macro generate the serialization and deserialization code.

Example:

#[derive(Debug, FromTvf, ToTvf)]
struct A {
    a: u32,

    #[tvf(id = 10)]
    b: bool,

    #[tvf(id = MY_FIELD)]
    c: String,
}

@oschijns
oschijns requested a review from reneca October 2, 2026 13:58
@reneca reneca added the enhancement New feature or request label Oct 3, 2026
Comment thread prosa_utils/src/msg/traits.rs Outdated
Comment thread prosa_macros/src/derive/ast.rs
Comment thread prosa_macros/src/derive/attr.rs Outdated
Comment thread prosa_macros/src/derive/attr.rs Outdated
Comment thread prosa_macros/src/derive/tokens.rs Outdated
@oschijns
oschijns force-pushed the derive-macro branch 3 times, most recently from 42f88cb to 57e1dcc Compare October 5, 2026 14:47
@reneca

reneca commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

As discussed, can you add unit tests. To check the T:Clone for example.
Also can you make an IntoTvf trait because it could be great to consume the struct to build the Tvf.

Olivier Schyns added 15 commits October 21, 2026 17:26
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
… by owning the value

Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Olivier Schyns added 2 commits October 22, 2026 12:29
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
Signed-off-by: Olivier Schyns <olivier.schyns@worldline.com>
@reneca reneca changed the title FromTvf and ToTvf derive macros FromTvf, ToTvf, and IntoTvf derive macros Oct 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants