Taking a Vec here means the client is likely to make an unneeded copy of the input data. Turning this parameter into a &[u8] means adding a lifetime parameter to the whole of BufferType...
Maybe the solution is to use the types of the members directly for Buffer::new, and remove BufferType altogether? This would need a new trait to obtain the (ptr, size) tuple but is probably cleaner.
Taking a
Vechere means the client is likely to make an unneeded copy of the input data. Turning this parameter into a&[u8]means adding a lifetime parameter to the whole ofBufferType...Maybe the solution is to use the types of the members directly for
Buffer::new, and removeBufferTypealtogether? This would need a new trait to obtain the(ptr, size)tuple but is probably cleaner.