From 56d66bf7e9a68223d18318a3c3ea3a50d2050b14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Fri, 8 Dec 2023 11:32:47 +0100 Subject: [PATCH] Run cargo fmt --- src/lib.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index da61102..43596cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -108,10 +108,8 @@ impl Bytes { /// /// It seems it's not possible to do this as an actual `TryFrom` implementation. pub fn try_from( - f: impl FnOnce(&mut [u8]) -> core::result::Result - ) - -> core::result::Result - { + f: impl FnOnce(&mut [u8]) -> core::result::Result, + ) -> core::result::Result { let mut data = Self::new(); data.resize_to_capacity(); let result = f(&mut data); @@ -202,8 +200,7 @@ impl Bytes { // } /// Fallible conversion into differently sized byte buffer. - pub fn to_bytes(&self) -> Result, ()> - { + pub fn to_bytes(&self) -> Result, ()> { Bytes::::from_slice(self) } @@ -367,8 +364,7 @@ impl<'a, const N: usize> IntoIterator for &'a mut Bytes { } } -impl Serialize for Bytes -{ +impl Serialize for Bytes { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -378,16 +374,14 @@ impl Serialize for Bytes } // TODO: can we delegate to Vec deserialization instead of reimplementing? -impl<'de, const N: usize> Deserialize<'de> for Bytes -{ +impl<'de, const N: usize> Deserialize<'de> for Bytes { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { struct ValueVisitor<'de, const N: usize>(PhantomData<&'de ()>); - impl<'de, const N: usize> Visitor<'de> for ValueVisitor<'de, N> - { + impl<'de, const N: usize> Visitor<'de> for ValueVisitor<'de, N> { // type Value = Vec; type Value = Bytes;