-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Description
📰 Overview
Since PR: #221, typeshare correctly translates struct generics in Go.
The following Rust snippet:
#[typeshare]
pub(crate) struct ItemsGetAllResponse {
pub(crate) individual_responses: Vec<Response<Item, Error>>,
}
#[typeshare]
pub(crate) struct Response<T, E> {
pub(crate) content: Option<T>,
pub(crate) error: Option<E>,
}
Correctly translates to:
type Response[T any, E any] struct {
Content *T `json:"content,omitempty"`
Error *E `json:"error,omitempty"`
}
type ItemsGetAllResponse struct {
IndividualResponses []IndividualResponse[Item, Error] `json:"individualResponses"`
}
However, generic bounds aren't supported:
#[typeshare]
pub(crate) struct IndividualResponse<T: Item, E: Error> {
pub(crate) content: Option<T>,
pub(crate) error: Option<E>,
}
doesn't translate to
type Response[T Item, E Error] struct {
Content *T `json:"content,omitempty"`
Error *E `json:"error,omitempty"`
}
Metadata
Metadata
Assignees
Labels
No labels