一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
19 行
393 B
Rust
19 行
393 B
Rust
use parser_utils::{parse::Parse, reader::Reader};
|
|
|
|
#[derive(Parse)]
|
|
struct Test {
|
|
#[pad_to_alignment(4)]
|
|
a: u8,
|
|
b: u8,
|
|
}
|
|
|
|
#[test]
|
|
fn test_parse() {
|
|
let data: [u8; 5] = [1, 2, 3, 4, 5];
|
|
let mut reader = Reader::new(&data);
|
|
let parsed = Test::parse(&mut reader).unwrap();
|
|
assert_eq!(parsed.a, 1);
|
|
assert_eq!(parsed.b, 5);
|
|
assert_eq!(reader.remaining(), 0);
|
|
}
|