Type Alias TransformFn

Source
pub type TransformFn = Box<dyn FnMut(&mut [u8], usize, bool) -> Option<(Vec<u8>, usize)>>;
Expand description

transform function which takes buffer and returns Vec<u8> and length of processed bytes

§Params

  • buffer - u8 slice to process
  • position - position (total number of processed bytes)
  • last_attempt - will be true if EOF is reached, input buffer length is greater than zero, and previous call returned None. Indicates that this is last attempt before throwing error.

§Return

  • function returns Result tuple with vector of processed bytes and length of bytes processed in input buffer. If function requires some more bytes to process succesfully it must return None.

§Note about size in the function return

Size in the function return related to the input buffer and not output vector. For example if our function filters even bytes in [1,2,3,4,5,6] returned size must be 6 and not 3.

Aliased Type§

struct TransformFn(/* private fields */);