pub struct BufferConfig { /* private fields */ }Expand description
The configuration for the network buffers
Implementations§
Source§impl BufferConfig
impl BufferConfig
Sourcepub fn from_config(config: &Config) -> BufferConfig
pub fn from_config(config: &Config) -> BufferConfig
Tries to deserialise a configuration instance from the specified in the given config.
Returns the same values as BufferConfig::default if it fails to read from the config.
Sourcepub fn from_config_file<P>(path: P) -> BufferConfig
pub fn from_config_file<P>(path: P) -> BufferConfig
Tries to deserialise a BufferConfig from a TOML file at path
Returns the same values as BufferConfig::default if it fails to read from the config.
§Panics
Panics if it fails to load the file or fails to load the file as TOML.
Sourcepub fn chunk_size(&mut self, size: usize)
pub fn chunk_size(&mut self, size: usize)
Sets the chunk_size to the given number of bytes.
Specifies the size in bytes of each BufferChunk instance produced by pools using this configuration.
Must be at least 128 bytes, and must also be greater than encode_buf_min_free_space.
Sourcepub fn chunk_size_bytes(&self) -> usize
pub fn chunk_size_bytes(&self) -> usize
Returns the configured chunk size in bytes.
Sourcepub fn initial_chunk_count(&mut self, count: usize)
pub fn initial_chunk_count(&mut self, count: usize)
Sets the initial_chunk_count to the given number.
Specifies the number of BufferChunk instances that pools using this configuration create initially.
May be at most the value of max_chunk_count.
Sourcepub fn max_chunk_count(&mut self, count: usize)
pub fn max_chunk_count(&mut self, count: usize)
Sets the max_chunk_count to the given number.
Specifies the maximum number of BufferChunk instances that pools using this configuration may create.
Must be at least the value of initial_chunk_count.
Sourcepub fn encode_buf_min_free_space(&mut self, size: usize)
pub fn encode_buf_min_free_space(&mut self, size: usize)
Sets the encode_buf_min_free_space to the given number of bytes.
This sets the minimum number of bytes an EncodeBuffer must have available before attempting any serialisation into it.
Must be less than chunk_size.
Trait Implementations§
Source§impl Clone for BufferConfig
impl Clone for BufferConfig
Source§fn clone(&self) -> BufferConfig
fn clone(&self) -> BufferConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BufferConfig
impl Debug for BufferConfig
Source§impl Default for BufferConfig
impl Default for BufferConfig
Source§fn default() -> BufferConfig
fn default() -> BufferConfig
Create a new configuration with default values which may then be overwritten
- chunk_size default value is
128 000. - initial_chunk_count default value is
2. - max_chunk_count default value is
1 000. - encode_buf_min_free_space is
64.
Source§impl PartialEq for BufferConfig
impl PartialEq for BufferConfig
Source§fn eq(&self, other: &BufferConfig) -> bool
fn eq(&self, other: &BufferConfig) -> bool
self and other values to be equal, and is used by ==.impl Eq for BufferConfig
impl StructuralPartialEq for BufferConfig
Auto Trait Implementations§
impl Freeze for BufferConfig
impl RefUnwindSafe for BufferConfig
impl Send for BufferConfig
impl Sync for BufferConfig
impl Unpin for BufferConfig
impl UnsafeUnpin for BufferConfig
impl UnwindSafe for BufferConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DispatchEvent for T
impl<T> DispatchEvent for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.