Skip to content

Use native Rust references instead of wrappers - #169

Merged
VeaaC merged 4 commits into
heremaps:masterfrom
VeaaC:simple_flat
Apr 15, 2020
Merged

VeaaC merged 4 commits into
heremaps:masterfrom
VeaaC:simple_flat

Conversation

@VeaaC

@VeaaC VeaaC commented Mar 3, 2020 •

Copy link
Copy Markdown
Collaborator

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

boxdot commented Mar 6, 2020

Copy link
Copy Markdown
Contributor

Is this still WIP?

@VeaaC

VeaaC commented Mar 6, 2020

Copy link
Copy Markdown
Collaborator Author

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

Comment thread flatdata-rs/lib/src/test/test_generated.rs Outdated
@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

VeaaC commented Apr 12, 2020

Copy link
Copy Markdown
Collaborator Author

@boxdot ready for review

@boxdot boxdot left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread flatdata-rs/lib/src/arrayview.rs
Comment thread flatdata-rs/lib/src/multiarrayview.rs Outdated
Comment thread flatdata-rs/lib/src/multiarrayview.rs Outdated
Comment thread flatdata-rs/lib/src/structs.rs Outdated
Comment thread flatdata-rs/lib/src/structs.rs
Comment thread flatdata-rs/lib/src/vector.rs Outdated
Comment thread flatdata-rs/lib/src/vector.rs Outdated

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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)

Comment thread flatdata-rs/lib/src/test/test_generated.rs
Comment thread flatdata-generator/flatdata/generator/templates/rust/rust.jinja2 Outdated
VeaaC added 4 commits April 13, 2020 14:33
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

boxdot commented Apr 15, 2020

Copy link
Copy Markdown
Contributor

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.

2 participants