-
-
Notifications
You must be signed in to change notification settings - Fork 42
Add deserializer for amf0 value and fix amf0 visitor fns #441
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
base: main
Are you sure you want to change the base?
Conversation
e0d9c72
to
a70a46d
Compare
Deploying scuffle-docusaurus-docs with
|
Latest commit: |
51e201e
|
Status: | ✅ Deploy successful! |
Preview URL: | https://42898d9c.scuffle-docusaurus-docs.pages.dev |
Branch Preview URL: | https://pr-441.scuffle-docusaurus-docs.pages.dev |
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.
good first steps
Deploying scuffle-docrs with
|
Latest commit: |
51e201e
|
Status: | ✅ Deploy successful! |
Preview URL: | https://4c3f1547.scuffle-docrs.pages.dev |
Branch Preview URL: | https://pr-441.scuffle-docrs.pages.dev |
❌ 4 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
3e3dccf
to
5f2294a
Compare
19cf429
to
da75542
Compare
c9acbd3
to
8e56bdd
Compare
✅ Release Checks Passed⭐ Package Changes
cargo xtask release check
|
9db97e6
to
2debfe2
Compare
a04e9b0
to
872c169
Compare
serde::forward_to_deserialize_any! { | ||
bool f64 char str string unit | ||
seq map newtype_struct tuple | ||
struct enum ignored_any identifier |
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.
Perhaps in a future ticket we should take into account the struct
field ordering, see samscott89/serde_qs#128 as an example of how to do that.
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 made a ticket for it for now, I might tackle it in the future: CLOUD-123
45d8dcb
to
52ccb99
Compare
crates/amf0/src/de/mod.rs
Outdated
// same as before about the string stuff | ||
// let bytes = [Amf0Marker::String as u8]; | ||
// let err = from_buf::<()>(Bytes::from_owner(bytes)).unwrap_err(); | ||
// assert!(matches!( | ||
// err, | ||
// Amf0Error::UnexpectedType { | ||
// expected: [Amf0Marker::Null, Amf0Marker::Undefined], | ||
// got: Amf0Marker::String | ||
// } | ||
// )); |
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.
Why is this test commented out?
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.
It was a leftover from when I was confused about how to handle the errors from attempting to deserialize the String. I think we can delete it though since it's just checking the error output.
crates/amf0/src/de/mod.rs
Outdated
@@ -202,8 +200,12 @@ where | |||
where |
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.
forward to any
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.
Removing this causes the optional()
test to fail. My current understanding is that forwarding to any doesn't handle the null properly so it keeps looping over and over causing a stack overflow.
@philipch07 i pushed a commit showing sort of what i was looking for. What is currently outstanding on this PR is testing forward / backward ser-de impls. Meaning that everytime we serialize should be able to be deserialized back. So the goal is to now: test serde-back-and-forth for all types Sort of like this flow let rust_type = something;
let amf0_bytes = rust_type.encode();
let rust_type2 = amf0_bytes.decode();
assert_eq(rust_type, rust_type2);
let amf0_value= amf0_bytes.decode();
let rust_type3 = amf0_value.decode();
assert_eq(rust_type, rust_type3); |
feb05eb
to
3c284b8
Compare
…to include bytes-util change from troy
3c284b8
to
8c429d9
Compare
The deserializer is a qol feature for people using amf0.
The current amf0 visitor functions do not properly call the corresponding visit functions, for example, an
i8
currently callsself.deserialize_i64(visitor)
(incorrect) instead ofself.deserialize_i8(visitor)
(correct).For more on the above topic, see the Notion doc. Just a heads up that it's also missing a rule which is mentioned in Troy's other #441 (comment)
Additionally this PR aims to address the following from Troy's comment (see below):