Trait const_writer::ConstWriterAdapter [−][src]
Source of all performance of crate. Provide unsafe interface to underlying buffer.
Because const generics expressions in traits works really bad,
this adapter doesn't has generic len param, so write is basically unchecked write to array.
This adapter must be used within ConstWriter
because it holds and tracks buffer length
Required methods
unsafe fn write<const N: usize>(self, value: &[u8; N]) -> Self
[src]
Write bytes and advances inner buffer
Safety
Unsafe because with current const_generics
and const_evaluatable_checked
we can't
define trait which returns self with calculated const generic param.
You should make sure that in total you advance less or equal than N
bytes
unsafe fn grow<const M: usize>(self) -> Self
[src]
Ensures that underlying buffer have space for M
additional bytes
Example
If 5 bytes were written to buffer, then grow::<10>()
will ensure that
underlying buffer have capacity at least 15