Skip to content

Support for std::sync::Arc as indirection #429

@segeljakt

Description

@segeljakt

Hi, I wonder, would be possible to allow prost-types to be wrapped inside std::sync::Arc? The reason is that I want my messages to be sendable across both processes and threads. When sent across processes, my messages should be serialized/deserialized with prost. When sent across threads, I would like to use reference counting.

#[derive(prost::Message)]
struct MyMessage {
    #[prost(string, tag = "1")]
    label: Arc<String>,
    #[prost(message, tag = "2")]
    payload: Arc<Payload>,
}

#[derive(prost::Message)]
struct Payload {
    #[prost(i32, repeated, tag = "1")]
    stuff: Vec<i32>,
}

Thanks for the great crate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions