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

Commit 8be4216a authored by Martin Geisler's avatar Martin Geisler Committed by Automerger Merge Worker
Browse files

Merge changes from topic "cherrypicker-L76600000960405157:N45800001364684986"...

Merge changes from topic "cherrypicker-L76600000960405157:N45800001364684986" into tm-mainline-prod am: abe848d3 am: c65515b1 am: a7997294

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/22985767



Change-Id: Iab9826c9232d2f68f919f93d24fc5e5d21e6b401
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 68a8bc02 a7997294
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -345,7 +345,11 @@ impl<'a> FieldParser<'a> {
                    // TODO(mgeisler): use
                    // https://doc.rust-lang.org/std/array/fn.try_from_fn.html
                    // when stabilized.
                    let #id = [0; #count].map(|_| #parse_element.unwrap());
                    let #id = (0..#count)
                        .map(|_| #parse_element)
                        .collect::<Result<Vec<_>>>()?
                        .try_into()
                        .map_err(|_| Error::InvalidPacketError)?;
                });
            }
            (ElementWidth::Unknown, ArrayShape::CountField(count_field)) => {
@@ -384,7 +388,11 @@ impl<'a> FieldParser<'a> {
                    // TODO(mgeisler): use
                    // https://doc.rust-lang.org/std/array/fn.try_from_fn.html
                    // when stabilized.
                    let #id = [0; #count].map(|_| #parse_element.unwrap());
                    let #id = (0..#count)
                        .map(|_| #parse_element)
                        .collect::<Result<Vec<_>>>()?
                        .try_into()
                        .map_err(|_| Error::InvalidPacketError)?;
                });
            }
            (ElementWidth::Static(_), ArrayShape::CountField(count_field)) => {
+13 −9
Original line number Diff line number Diff line
@@ -127,16 +127,20 @@ impl BarData {
                got: bytes.get().remaining(),
            });
        }
        let x = [0; 5].map(|_| {
            Foo::try_from(bytes.get_mut().get_uint(3) as u32)
                .map_err(|_| Error::InvalidEnumValueError {
        let x = (0..5)
            .map(|_| {
                Foo::try_from(bytes.get_mut().get_uint(3) as u32).map_err(|_| {
                    Error::InvalidEnumValueError {
                        obj: "Bar".to_string(),
                        field: String::new(),
                        value: 0,
                        type_: "Foo".to_string(),
                    }
                })
                .unwrap()
        });
            })
            .collect::<Result<Vec<_>>>()?
            .try_into()
            .map_err(|_| Error::InvalidPacketError)?;
        Ok(Self { x })
    }
    fn write_to(&self, buffer: &mut BytesMut) {
+13 −9
Original line number Diff line number Diff line
@@ -127,16 +127,20 @@ impl BarData {
                got: bytes.get().remaining(),
            });
        }
        let x = [0; 5].map(|_| {
            Foo::try_from(bytes.get_mut().get_uint_le(3) as u32)
                .map_err(|_| Error::InvalidEnumValueError {
        let x = (0..5)
            .map(|_| {
                Foo::try_from(bytes.get_mut().get_uint_le(3) as u32).map_err(|_| {
                    Error::InvalidEnumValueError {
                        obj: "Bar".to_string(),
                        field: String::new(),
                        value: 0,
                        type_: "Foo".to_string(),
                    }
                })
                .unwrap()
        });
            })
            .collect::<Result<Vec<_>>>()?
            .try_into()
            .map_err(|_| Error::InvalidPacketError)?;
        Ok(Self { x })
    }
    fn write_to(&self, buffer: &mut BytesMut) {
+5 −1
Original line number Diff line number Diff line
@@ -80,7 +80,11 @@ impl FooData {
                got: bytes.get().remaining(),
            });
        }
        let x = [0; 5].map(|_| Ok::<_, Error>(bytes.get_mut().get_uint(3) as u32).unwrap());
        let x = (0..5)
            .map(|_| Ok::<_, Error>(bytes.get_mut().get_uint(3) as u32))
            .collect::<Result<Vec<_>>>()?
            .try_into()
            .map_err(|_| Error::InvalidPacketError)?;
        Ok(Self { x })
    }
    fn write_to(&self, buffer: &mut BytesMut) {
+5 −1
Original line number Diff line number Diff line
@@ -80,7 +80,11 @@ impl FooData {
                got: bytes.get().remaining(),
            });
        }
        let x = [0; 5].map(|_| Ok::<_, Error>(bytes.get_mut().get_uint_le(3) as u32).unwrap());
        let x = (0..5)
            .map(|_| Ok::<_, Error>(bytes.get_mut().get_uint_le(3) as u32))
            .collect::<Result<Vec<_>>>()?
            .try_into()
            .map_err(|_| Error::InvalidPacketError)?;
        Ok(Self { x })
    }
    fn write_to(&self, buffer: &mut BytesMut) {
Loading