-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add serde derives #26
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't see this sooner - I wasn't previously watching peniko
This looks good, but we need to change CI to be using cargo-hack
before adding this feature. That is, implement linebender/vello#504 (and some follow-ups) for this repo.
That should mostly require copy-and-pasting from Vello's CI. I'd suggest doing that in a different PR.
CC @xStrom for awareness
I'll have to look through the usage of
I don't believe we use the |
We can do it with two commands: cargo hack check --features libm --each-feature and cargo hack check --features std --each-feature |
Will try and look into CI things soon. |
I'll port over all the CI changes from Vello, should have PR up in about an hour. |
Alright #28 is ready for review. |
Okay #28 is merged, so this PR should now be rebased and we'll see what the new CI thinks of it. |
Seems to work great, already found one oversight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering about Font
and why it didn't get the derives.
Lines 6 to 13 in 6f4150f
/// Owned shareable font resource. | |
#[derive(Clone, PartialEq, Debug)] | |
pub struct Font { | |
/// Blob containing the content of the font file. | |
pub data: Blob<u8>, | |
/// Index of the font in a collection, or 0 for a single font. | |
pub index: u32, | |
} |
Is it because the index
makes serializing too unstable or something else?
src/brush.rs
Outdated
#[cfg_attr(feature = "serde", derive(serde::Serialize))] | ||
pub enum BrushRef<'a> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mentioned in #16 that maybe BrushRef
shouldn't derive even Serialize
and I'm wondering the same. If this can be only serialized and not deserialized, what is the use case for it? 🤔
However if we keep it, then perhaps StyleRef
should get a Serialize
derive as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, I had forgotten about that bit, so I'll go ahead and remove it. Then if someone figures out a use for it in the future it could be added then (like perhaps it can be deserialized into an owned Brush).
I was just needing enough to Serialize/Deserialize strokes/fills and the necessary components to pass to those scene functions in vello. I did look at this but then this index is exactly what scared me off from adding it, I figured I would let someone who was going to use the feature/ and would be in a better place to understand what is going on with that index do so. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your efforts!
This splits off just the serde support from #16 which originally contained both serde and schemars features.
None of my projects need schemars support, I mostly added it for feature parity with kurbo, but supporting blobs nicely required some upstream patches.
This adds a dependency on
serde_bytes
forBlob
which is also a dtolnay crate.