Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Fixed bitflags invocation and added <F = ()> parsing#27

Merged
VictorKoenders merged 1 commit intotrunkfrom
default_generics
Aug 18, 2022
Merged

Fixed bitflags invocation and added <F = ()> parsing#27
VictorKoenders merged 1 commit intotrunkfrom
default_generics

Conversation

@VictorKoenders
Copy link
Contributor

@VictorKoenders VictorKoenders commented Aug 18, 2022

  • Fixed an issue where virtue wouldn't properly parse a bitflags call
  • Made virtue parse <F = ()> constraints (closes #25)
  • Fixed clippy lints
  • Added a test suite

Made virtue parse `<F = ()>` constraints
Fixed clippy lints
Added a test suite
@codecov
Copy link

codecov bot commented Aug 18, 2022

Codecov Report

Merging #27 (c83f3cc) into trunk (4c16ea5) will decrease coverage by 0.27%.
The diff coverage is 49.05%.

@@            Coverage Diff             @@
##            trunk      #27      +/-   ##
==========================================
- Coverage   39.18%   38.91%   -0.28%     
==========================================
  Files          17       19       +2     
  Lines        1799     1840      +41     
==========================================
+ Hits          705      716      +11     
- Misses       1094     1124      +30     
Impacted Files Coverage Δ
src/parse/body.rs 65.16% <0.00%> (-0.54%) ⬇️
src/utils.rs 79.59% <ø> (ø)
test/derive/src/lib.rs 0.00% <0.00%> (ø)
test/src/main.rs 0.00% <0.00%> (ø)
src/parse/visibility.rs 73.52% <30.76%> (-26.48%) ⬇️
src/parse/generics.rs 58.88% <95.65%> (+2.54%) ⬆️
src/parse/utils.rs 85.07% <0.00%> (-2.62%) ⬇️
src/lib.rs 38.89% <0.00%> (-0.99%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@VictorKoenders
Copy link
Contributor Author

Seems to indeed fix #55, tested with the latest bincode and this version of virtue:

#[derive(bincode::Encode)]
struct DefaultGenerics<T = String> {
    inner: T,
}
#[test]
fn test_default_generics() {
    let generics = DefaultGenerics {
        inner: String::from("Hello world"),
    };
    let bytes = bincode::encode_to_vec(&generics, bincode::config::legacy()).unwrap();
    assert_eq!(
        bytes,
        &[11, 0, 0, 0, 0, 0, 0, 0, 72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
    );
    let generics = DefaultGenerics {
        inner: 0xDEADBEEFu32,
    };
    let bytes =
        bincode::encode_to_vec(&generics, bincode::config::legacy().with_big_endian()).unwrap();
    assert_eq!(bytes, &[0xDE, 0xAD, 0xBE, 0xEF],);
}

@VictorKoenders VictorKoenders merged commit 2acf4e5 into trunk Aug 18, 2022
@VictorKoenders VictorKoenders deleted the default_generics branch August 18, 2022 11:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generic default parameters not supported

1 participant