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

Use native Rust references instead of wrappers #169

Merged
merged 4 commits into from
Apr 15, 2020

Conversation

VeaaC
Copy link
Collaborator

@VeaaC VeaaC commented Mar 3, 2020

Note: This is a breaking change!

Changes:

  • A struct transparently wraps a byte array of correct size
  • Instead of Ref/RefMute &Struct and &mut Struct are used
  • ArrayView is replaced by native slices
  • Archives store members with 'static lifetime, instead of constructing them all the time from pointers

@VeaaC VeaaC requested a review from boxdot March 3, 2020 09:34
@boxdot
Copy link
Collaborator

boxdot commented Mar 6, 2020

Is this still WIP?

@VeaaC
Copy link
Collaborator Author

VeaaC commented Mar 6, 2020

A few things left to clean up, should finish this weekend

@VeaaC VeaaC changed the title WIP: Try using native Rust references instead of wrappers Use native Rust references instead of wrappers Mar 7, 2020
@VeaaC VeaaC force-pushed the simple_flat branch 4 times, most recently from 0e9a428 to 53784fc Compare April 11, 2020 16:33
@VeaaC
Copy link
Collaborator Author

VeaaC commented Apr 12, 2020

@boxdot ready for review

Copy link
Collaborator

@boxdot boxdot left a comment

Choose a reason for hiding this comment

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

There are still some clippy warning. But I think they are not that important and we can fix them after this is merged.

flatdata-rs/lib/src/arrayview.rs Show resolved Hide resolved
flatdata-rs/lib/src/multiarrayview.rs Outdated Show resolved Hide resolved
flatdata-rs/lib/src/multiarrayview.rs Outdated Show resolved Hide resolved
flatdata-rs/lib/src/structs.rs Outdated Show resolved Hide resolved
flatdata-rs/lib/src/structs.rs Show resolved Hide resolved
flatdata-rs/lib/src/vector.rs Outdated Show resolved Hide resolved
flatdata-rs/lib/src/vector.rs Outdated Show resolved Hide resolved

/// Number of elements in the vector.
#[inline]
pub fn len(&self) -> usize {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason for removing this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You get it for free from Deref<&[T]> (like most other slice functions I removed)

flatdata-rs/lib/src/test/test_generated.rs Show resolved Hide resolved
Note: This is a breaking change!

Changes:
* A struct transparently wraps a byte array of correct size
* Instead of Ref/RefMute &Struct and &mut Struct are used
* ArrayView is replaced by native slices
* Archives store members with 'static lifetime, instead of constructing them all the time from pointers

Signed-off-by: Christian Vetter <christian.vetter@here.com>
Signed-off-by: Christian Vetter <christian.vetter@here.com>
Signed-off-by: Christian Vetter <christian.vetter@here.com>
Signed-off-by: Christian Vetter <christian.vetter@here.com>
@boxdot
Copy link
Collaborator

boxdot commented Apr 15, 2020

Impressive!

@VeaaC VeaaC merged commit 272adf5 into heremaps:master Apr 15, 2020
@VeaaC VeaaC deleted the simple_flat branch April 15, 2020 10:05
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

2 participants