Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Rust slice type #131

Merged
merged 1 commit into from
Jul 1, 2023
Merged

Conversation

czocher
Copy link
Contributor

@czocher czocher commented Jun 21, 2023

Adds support for the Rust slice type e.g.:

#[typeshare]
#[derive(Serialize)]
pub struct Video<'a> {
    pub tags: &'a [Tag],
}

@LouisGariepy please verify if it works in your case.

Closes #126

@LouisGariepy
Copy link

@czocher Tested your branch on my project and it seems to work as intended as far as I can tell. Thanks.

@Lucretiel
Copy link
Contributor

This looks great! In the future, if it comes up, we can look at adding a warning for &[u8], which may not do what the user expects (both serde and typeshare will treat it as an array of integers rather than a byte blob), but we can leave that for if people have issues with it.

@Lucretiel Lucretiel merged commit 185bc4f into 1Password:main Jul 1, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typeshare panics when encountering slice of user type.
3 participants