-
Notifications
You must be signed in to change notification settings - Fork 581
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
Improve Span deserialization. #4595
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware)
corelib/src/array.cairo
line 147 at r1 (raw file):
serialized = serialized.slice(length, serialized.len() - length); Option::Some(Span { snapshot: res }) }
you probably need to make this impl have a negative param - and have a specific impl for Span
Code quote:
let length = *serialized.pop_front()?;;
let res = serialized.slice(0, length);
serialized = serialized.slice(length, serialized.len() - length);
Option::Some(Span { snapshot: res })
}
042428f
to
aa2c22d
Compare
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.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @orizi)
corelib/src/array.cairo
line 147 at r1 (raw file):
Previously, orizi wrote…
you probably need to make this impl have a negative param - and have a specific impl for Span
Done.
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.
Reviewed 1 of 3 files at r2.
Reviewable status: 1 of 3 files reviewed, 3 unresolved discussions (waiting on @ilyalesokhin-starkware)
corelib/src/array.cairo
line 7 at r2 (raw file):
use core::option::OptionTrait; use core::serde::Serde; use core::metaprogramming::{TypeEqual, TypeEqualImpl};
Suggestion:
use core::metaprogramming::TypeEqual;
corelib/src/lib.cairo
line 355 at r2 (raw file):
// Metaprogramming. pub mod metaprogramming;
Suggestion:
// Metaprogramming.
mod metaprogramming;
corelib/src/metaprogramming.cairo
line 5 at r2 (raw file):
pub trait TypeEqual<S, T> {} pub impl TypeEqualImpl<T> of TypeEqual<T, T>;
Suggestion:
/// A trait that can be used to disable implementations based on the types of the generic args.
/// Assumes that `TypeEqualImpl` is the only implementation of this trait.
pub trait TypeEqual<S, T> {}
impl TypeEqualImpl<T> of TypeEqual<T, T>;
aa2c22d
to
4405a2f
Compare
why? |
what about the idea that only pub impls can be infered? |
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.
Reviewable status: 1 of 3 files reviewed, 3 unresolved discussions (waiting on @orizi)
corelib/src/array.cairo
line 7 at r2 (raw file):
use core::option::OptionTrait; use core::serde::Serde; use core::metaprogramming::{TypeEqual, TypeEqualImpl};
Done.
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.
Reviewed 1 of 3 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware)
corelib/src/metaprogramming.cairo
line 5 at r2 (raw file):
Previously, ilyalesokhin-starkware wrote…
what about the idea that only pub impls can be infered?
we have decided against it.
4405a2f
to
0012faf
Compare
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.
Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @orizi)
corelib/src/metaprogramming.cairo
line 5 at r2 (raw file):
Previously, orizi wrote…
we have decided against it.
Done.
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.
Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)
0012faf
to
062d308
Compare
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)