Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ jobs:
run: cargo update --package async-io --precise 2.5.0
- name: Pin last polling release supporting our msrv of Rust 1.68
run: cargo update --package polling --precise 3.10.0
- name: Pin last async-lock release supporting our msrv of Rust 1.68
run: cargo update --package async-lock --precise 3.4.1

# build
- name: cargo check x11rb-protocol with all features
Expand Down
35 changes: 19 additions & 16 deletions generator/src/generator/namespace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,25 +569,28 @@ impl<'ns, 'c> NamespaceGenerator<'ns, 'c> {
out,
);
let field_size = field.size().unwrap();
if bytes_name.is_some() && field_size == union_size {
outln!(out, "Self({})", bytes_name.unwrap());
} else {
outln!(out, "let value = [");
for result_byte in result_bytes.iter() {
outln!(out.indent(), "{},", result_byte);
match bytes_name {
Some(bytes_name) if field_size == union_size => {
outln!(out, "Self({})", bytes_name);
}
// This is needed to handle cases such as Behavior.type or
// Action.type from the XKB extension.
//
// FIXME: For those cases it might be better to omit the
// serialize implementation.
if field_size != union_size {
for _ in 0..(union_size - field_size) {
outln!(out.indent(), "0,");
_ => {
outln!(out, "let value = [");
for result_byte in result_bytes.iter() {
outln!(out.indent(), "{},", result_byte);
}
// This is needed to handle cases such as Behavior.type or
// Action.type from the XKB extension.
//
// FIXME: For those cases it might be better to omit the
// serialize implementation.
if field_size != union_size {
for _ in 0..(union_size - field_size) {
outln!(out.indent(), "0,");
}
}
outln!(out, "];");
outln!(out, "Self(value)");
}
outln!(out, "];");
outln!(out, "Self(value)");
}
});
outln!(out, "}}");
Expand Down