Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: 1.52.1
override: true
components: rustfmt
- name: Run
Expand All @@ -35,7 +35,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: 1.52.1
override: true
components: clippy
- name: Run
Expand All @@ -47,7 +47,7 @@ jobs:
matrix:
os: [ ubuntu-latest ]
rust:
- stable
- 1.52.1
- 1.41.0 # MSRV
fail-fast: true
max-parallel: 2
Expand All @@ -69,7 +69,7 @@ jobs:
matrix:
os: [ ubuntu-latest ]
rust:
- stable
- 1.52.1
- 1.41.0 # MSRV
fail-fast: true
max-parallel: 2
Expand Down
9 changes: 9 additions & 0 deletions examples/tests-loader/src/generators/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,15 @@ impl GenTest for types::Vector {
.build();
let expected = #name::from_slice(#expected).unwrap();
#assert_stmt
assert_eq!(
result.total_size(),
result.as_slice().len(),
"\nstruct: {}:\n data: {:#x}\n partial read total_size: {}, actual: {}\n",
#name::NAME,
result,
result.total_size(),
result.as_slice().len()
);
}
);
vec![test]
Expand Down
2 changes: 1 addition & 1 deletion tools/codegen/src/generator/languages/rust/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl DefProperties for ast::FixVec {
fn def_properties(&self) -> m4::TokenStream {
quote!(
pub fn total_size(&self) -> usize {
molecule::NUMBER_SIZE * (self.item_count() + 1)
molecule::NUMBER_SIZE + Self::ITEM_SIZE * self.item_count()
}
pub fn item_count(&self) -> usize {
molecule::unpack_number(self.as_slice()) as usize
Expand Down