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

Rkyv support #223

Merged
merged 7 commits into from
Aug 9, 2021
Merged

Conversation

hannes-vernooij
Copy link
Contributor

Added rkyv support

Copy link

@djkoloski djkoloski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting the ball rolling on this! It looks really good and I'd like to help out where I can.

Cargo.toml Outdated
@@ -15,6 +15,9 @@ maintenance = { status = "actively-developed" }

[features]
default = ["std"]
rkyv_size_16 = ["rkyv/size_16"]
rkyv_size_32 = ["rkyv/size_32"]
rkyv_size_64 = ["rkyv/size_64"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These features are meant to be controlled by a top-level crate. I think that whatever uses glam and rkyv can choose these features and they'll unify all the way down.

Cargo.toml Outdated Show resolved Hide resolved
#[cfg(not(any(feature = "archive_le", feature = "archive_be")))]
type Archived = $type;
#[cfg(feature = "archive_le")]
type Archived = rend::LittleEndian<$type>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this will work right. There might be some work to do here if you want glam types to support little- and big-endian, since some of the SIMD types are new primitives. If glam is using a standard crate I can see about getting this work done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the endian conversion step for now until support has been added to convert SIMD types. This is mentioned in the readme and can be added in a follow-up PR. Progress can be tracked here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, looks great! I'll be digging into this more comprehensively in rkyv/rend#4

removed rkyv_size features & changed the optional rkyv dependency to version 0.7
Added the rkyv and bytecheck to the optional feature list
This is currently not supported for SIMD types yet
Copy link

@djkoloski djkoloski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all look good to me!

@bitshifter
Copy link
Owner

Sorry I've been quite busy the last few days, I will look at this soon.

};

(@archive_deserialize $type:ty) => {
const _: () = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this block necessary?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like scoping for the type alias right below (type Archived = $type). Doesn't look strictly necessary to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was to scope the type alias. I removed the scope.

Copy link
Owner

@bitshifter bitshifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me, just one question about the need for the const block.

removed a const block to scope a type alias
@bitshifter
Copy link
Owner

clippy failed on internal rkyv things, which is strange.

@hannes-vernooij
Copy link
Contributor Author

hannes-vernooij commented Aug 9, 2021

clippy failed on internal rkyv things, which is strange.

If I understand the error correctly it means that size_16 size_32 or size_64 need to be passed as a feature by the crate using glam. I can look into getting size_32 enabled by default, or would it be better to define these in the top level crate as previously suggested by djkoloski?

@djkoloski
Copy link

This looks like it may be a situation where we want:

[dependencies]
rkyv = { version = "0.7", optional = true, default-features = false }

[dev-dependencies]
rkyv = "0.7"

However, this looks like it's only supported by the feature resolver version 2, which would bump the MSRV to 1.50. Feature resolver version 1 will incorrectly unify the default features from the dev-dependencies with the regular dependency features.

@bitshifter
Copy link
Owner

I would be OK with switching to feature resolver version 2, it would address some other problems I hit in glam. That can happen separate to this PR though.

@bitshifter bitshifter merged commit ddc7047 into bitshifter:master Aug 9, 2021
@bitshifter
Copy link
Owner

@djkoloski incidentally it looks like rkyv's MSRV is 1.53 for use of or patterns (the readme says 1.52).

@djkoloski
Copy link

Perfect, it's not an issue for rkyv users then. I'll probably follow suit and switch to feature resolver 2 (I believe there are some feature issues currently).

@hannes-vernooij hannes-vernooij deleted the rkyv_support branch August 10, 2021 07:28
@bitshifter
Copy link
Owner

Hmm, even with feature resolver 2 I'm still getting the clippy build fail if I disable default features on rkyv as suggested here #223 (comment)

@djkoloski
Copy link

Hmm, that's not the result I got when I did some testing. I'll take a look as soon as I have a chance.

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.

None yet

3 participants