pub fn parse_ascii_nul_string_values<D: Default, F: Fn(&mut D, &[u8]) -> Result<(), &'static str>>(bytes: &[u8], add_ascii_string: &F) -> Result<D, &'static str>
{
	let length = bytes.len();

	let mut collection = D::default();
	if unlikely!(length == 0)
	{
		return Ok(collection)
	}

	const AsciiNul: u8 = b'\0';

	let final_byte_index = length - 1;
	let final_byte = bytes.get_unchecked_value_safe(final_byte_index);
	if unlikely!(final_byte != AsciiNul)
	{
		return Err("bytes must end with an Ascii NUL");
	}

	for ascii_string in (&bytes[0 .. final_byte_index]).split_bytes(AsciiNul)
	{
		add_ascii_string(&mut collection, ascii_string)?
	}
	Ok(collection)
}
/// Parse a set of ASCII strings each terminated by NUL, or, an empty (zero byte) value.
Parse a set of ASCII strings each terminated by NUL, or, an empty (zero byte) value.
Parse a set of ASCII strings each terminated by NUL or an empty ( zero byte ) value .
pub fn parse_ascii_nul_string_values<D: Default, F: Fn(&mut D, &[u8]) -> Result<(), &'static str>>(bytes: &[u8], add_ascii_string: &F) -> Result<D, &'static str>
{
	let length = bytes.len();
	let mut collection = D::default();
	if unlikely!(length == 0)
	{
		return Ok(collection)
	}
	const AsciiNul: u8 = b'\0';
	let final_byte_index = length - 1;
	let final_byte = bytes.get_unchecked_value_safe(final_byte_index);
	if unlikely!(final_byte != AsciiNul)
	{
		return Err("bytes must end with an Ascii NUL");
	}
	for ascii_string in (&bytes[0 .. final_byte_index]).split_bytes(AsciiNul)
	{
		add_ascii_string(&mut collection, ascii_string)?
	}
	Ok(collection)
}
pub fn parse_ascii_nul_string_values < D : Default , F : Fn ( & mut D , & [ u8 ] ) -> Result < ( ) , & ' static str > > ( bytes : & [ u8 ] , add_ascii_string : & F ) -> Result < D , & ' static str > { let length = bytes . len ( ) ; let mut collection = D :: default ( ) ; if unlikely ! ( length 0 ) { return Ok ( collection ) } const AsciiNul : u8 = b'\0' ; let final_byte_index = length - 1 ; let final_byte = bytes . get_unchecked_value_safe ( final_byte_index ) ; if unlikely ! ( final_byte AsciiNul ) { return Err ( " " ) ; } for ascii_string in ( & bytes [ 0 .. final_byte_index ] ) . split_bytes ( AsciiNul ) { add_ascii_string ( & mut collection , ascii_string ) ? } Ok ( collection ) }
Parse a set of ASCII strings each terminated by NUL, or, an empty (zero byte) value.
Parse a set of ASCII strings each terminated by NUL or an empty ( zero byte ) value .
bytes
&[u8]
add_ascii_string
&F
bytes
&[u8]
add_ascii_string
&F