Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0e32c86 authored by Rahul Arya's avatar Rahul Arya Committed by Gerrit Code Review
Browse files

Merge "Rust PDL backend"

parents 3fe963f6 caa5be2f
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
@@ -289,3 +289,44 @@ python_test_host {
        ":pypdl",
    ],
}

// Defaults for the rust_noalloc backend
genrule_defaults {
    name: "pdl_rust_noalloc_generator_defaults",
    cmd: "set -o pipefail;" +
        " $(location :pdl) --output-format rust_no_alloc $(in) |" +
        " $(location :rustfmt) > $(out)",
    tools: [
        ":pdl",
        ":rustfmt",
    ],
}

// Generate the rust_noalloc backend srcs against the little-endian test vectors
genrule {
    name: "pdl_rust_noalloc_le_test_backend_srcs",
    defaults: ["pdl_rust_noalloc_generator_defaults"],
    srcs: ["tests/canonical/le_rust_noalloc_test_file.pdl"],
    out: ["_packets.rs"],
}

// Generate the rust_noalloc test harness srcs for the supplied test vectors
genrule {
    name: "pdl_rust_noalloc_le_test_gen_harness",
    cmd: "set -o pipefail;" +
        " $(location :pdl) $(in) --output-format rust_no_alloc_test" +
        " > $(out)",
    srcs: ["tests/canonical/le_rust_noalloc_test_file.pdl"],
    out: ["test_rust_noalloc_parser.rs"],
    tools: [":pdl"],
}

// The test target for rust_noalloc
rust_test_host {
    name: "pdl_rust_noalloc_le_test",
    srcs: [
        ":pdl_rust_noalloc_le_test_gen_harness",
        ":pdl_rust_noalloc_le_test_backend_srcs",
    ],
    test_suites: ["general-tests"],
}
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@ pub enum Field {
    Size { loc: SourceRange, field_id: String, width: usize },
    #[serde(rename = "count_field")]
    Count { loc: SourceRange, field_id: String, width: usize },
    #[serde(rename = "elementsize_field")]
    ElementSize { loc: SourceRange, field_id: String, width: usize },
    #[serde(rename = "body_field")]
    Body { loc: SourceRange },
    #[serde(rename = "payload_field")]
@@ -260,6 +262,7 @@ impl Field {
            Field::Checksum { loc, .. }
            | Field::Padding { loc, .. }
            | Field::Size { loc, .. }
            | Field::ElementSize { loc, .. }
            | Field::Count { loc, .. }
            | Field::Body { loc, .. }
            | Field::Payload { loc, .. }
@@ -277,6 +280,7 @@ impl Field {
            Field::Checksum { .. }
            | Field::Padding { .. }
            | Field::Size { .. }
            | Field::ElementSize { .. }
            | Field::Count { .. }
            | Field::Body { .. }
            | Field::Payload { .. }
+2 −0
Original line number Diff line number Diff line
//! Compiler backends.

pub mod intermediate;
pub mod json;
pub mod rust;
pub mod rust_no_allocation;
+516 −0

File added.

Preview size limit exceeded, changes collapsed.

+155 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading