From cf71fe20abcc36cebf48daee89c4f7fcea1c960a Mon Sep 17 00:00:00 2001 From: Avril Date: Fri, 6 Aug 2021 16:11:54 +0100 Subject: [PATCH] Set `StackVec` stack size to 2KB (from 4KB). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fortune for rsh's current commit: Small blessing − 小吉 --- src/ext.rs | 2 +- src/message/tests.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ext.rs b/src/ext.rs index 02f7a28..dc648b5 100644 --- a/src/ext.rs +++ b/src/ext.rs @@ -5,7 +5,7 @@ use std::iter; use smallvec::SmallVec; /// Max size of memory allowed to be allocated on the stack. -pub const STACK_MEM_ALLOC_MAX: usize = 4096; +pub const STACK_MEM_ALLOC_MAX: usize = 2048; // 2KB /// A stack-allocated vector that spills onto the heap when needed. pub type StackVec = SmallVec<[T; STACK_MEM_ALLOC_MAX]>; diff --git a/src/message/tests.rs b/src/message/tests.rs index 07cfe7c..e4a05ad 100644 --- a/src/message/tests.rs +++ b/src/message/tests.rs @@ -12,9 +12,9 @@ where S: MessageSender, println!(">> Created message: {:?}", message); let serialised = message.serialise(s).expect("Failed to serialise message"); println!(">> Serialised message: {:?}", serialised); - let binary = serialised.into_bytes(); + let binary = serialised.into_bytes().expect("Failed to serialize to bytes"); println!(">> Written to {} bytes", binary.len()); - let read = SerializedMessage::from_bytes(&binary).expect("Failed to read serialised message from binary"); + let read = SerializedMessage::from_bytes(binary).expect("Failed to read serialised message from binary"); println!(">> Read from bytes: {:?}", read); let deserialised = Message::deserialize(&read, d).expect("Failed to deserialise message"); println!(">> Deserialised message: {:?}", deserialised);