diff options
author | Trinity Pointard <trinity.pointard@gmail.com> | 2021-03-22 00:01:44 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-04-27 16:37:10 +0200 |
commit | f8716895715b1a552750062aca9bc1882f6f95c0 (patch) | |
tree | 8babe2acf622b55e88cc34fcb0ed81745d14aa8a /src/util/data.rs | |
parent | 8e0524ae15e5252aecd30dc01d6993810cf49811 (diff) | |
download | garage-f8716895715b1a552750062aca9bc1882f6f95c0.tar.gz garage-f8716895715b1a552750062aca9bc1882f6f95c0.zip |
run cargo fmt on util and make missing doc warning
Diffstat (limited to 'src/util/data.rs')
-rw-r--r-- | src/util/data.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/util/data.rs b/src/util/data.rs index b269edac..34ee8a18 100644 --- a/src/util/data.rs +++ b/src/util/data.rs @@ -63,20 +63,20 @@ impl Serialize for FixedBytes32 { } impl FixedBytes32 { - /// Access the content as a slice + /// Access the content as a slice pub fn as_slice(&self) -> &[u8] { &self.0[..] } - /// Access the content as a mutable slice + /// Access the content as a mutable slice pub fn as_slice_mut(&mut self) -> &mut [u8] { &mut self.0[..] } - /// Copy to a slice + /// Copy to a slice pub fn to_vec(&self) -> Vec<u8> { self.0.to_vec() } - /// Try building a FixedBytes32 from a slice - /// Return None if the slice is not 32 bytes long + /// Try building a FixedBytes32 from a slice + /// Return None if the slice is not 32 bytes long pub fn try_from(by: &[u8]) -> Option<Self> { if by.len() != 32 { return None; @@ -151,8 +151,8 @@ pub fn debug_serialize<T: Serialize>(x: T) -> String { match serde_json::to_string(&x) { Ok(ss) => { if ss.len() > 100 { - // TODO this can panic if 100 is not a codepoint boundary, but inside a 2 Bytes - // (or more) codepoint + // TODO this can panic if 100 is not a codepoint boundary, but inside a 2 Bytes + // (or more) codepoint ss[..100].to_string() } else { ss |