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

Commit b059d4b0 authored by Zach Johnson's avatar Zach Johnson Committed by Gerrit Code Review
Browse files

Merge changes I6b64dc43,I499835b0

* changes:
  rusty-gd: start writing array fields in write_to()
  rusty-gd: add stubs for to_bytes and write_to
parents bb3440c6 e158eb32
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -205,3 +205,8 @@ void ArrayField::GenRustGetter(std::ostream& s, Size start_offset, Size) const {
  s << "bytes[" << start_offset.bytes() << "..";
  s << start_offset.bytes() + GetSize().bytes() << "].try_into().unwrap();";
}

void ArrayField::GenRustWriter(std::ostream& s, Size start_offset, Size) const {
  s << "&buffer[" << start_offset.bytes() << ".." << start_offset.bytes() + GetSize().bytes()
    << "].copy_from_slice(&self." << GetName() << ");";
}
+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ class ArrayField : public PacketField {

  void GenRustGetter(std::ostream& s, Size start_offset, Size end_offset) const override;

  void GenRustWriter(std::ostream& s, Size start_offset, Size end_offset) const override;

  const std::string name_;

  const PacketField* element_field_{nullptr};
+2 −0
Original line number Diff line number Diff line
@@ -82,3 +82,5 @@ std::string BodyField::GetRustDataType() const {

void BodyField::GenRustGetter(std::ostream&, Size, Size) const {
}

void BodyField::GenRustWriter(std::ostream&, Size, Size) const {}
+2 −0
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ class BodyField : public PacketField {

  void GenRustGetter(std::ostream& s, Size start_offset, Size end_offset) const override;

  void GenRustWriter(std::ostream& s, Size start_offset, Size end_offset) const override;

  // Body fields can only be dynamically sized.
  const SizeField* size_field_{nullptr};
};
+2 −0
Original line number Diff line number Diff line
@@ -66,3 +66,5 @@ void ChecksumField::GenStringRepresentation(std::ostream& s, std::string) const

void ChecksumField::GenRustGetter(std::ostream&, Size, Size) const {
}

void ChecksumField::GenRustWriter(std::ostream&, Size, Size) const {}
Loading