pub fn write_def_levels(
    writer: &mut Vec<u8>,
    is_optional: bool,
    validity: Option<&Bitmap>,
    len: usize,
    version: Version,
) -> Result<()> {
    // encode def levels
    match (is_optional, validity) {
        (true, Some(validity)) => encode_iter(writer, validity.iter(), version),
        (true, None) => encode_iter(writer, std::iter::repeat(true).take(len), version),
        _ => Ok(()), // is required => no def levels
    }
}
/// writes the def levels to a `Vec<u8>` and returns it.
writes the def levels to a `Vec` and returns it.
writes the def levels to a ` Vec ` and returns it .
pub fn write_def_levels(
    writer: &mut Vec<u8>,
    is_optional: bool,
    validity: Option<&Bitmap>,
    len: usize,
    version: Version,
) -> Result<()> {
    // encode def levels
    match (is_optional, validity) {
        (true, Some(validity)) => encode_iter(writer, validity.iter(), version),
        (true, None) => encode_iter(writer, std::iter::repeat(true).take(len), version),
        _ => Ok(()), // is required => no def levels
    }
}
pub fn write_def_levels ( writer : & mut Vec < u8 > , is_optional : bool , validity : Option < & Bitmap > , len : usize , version : Version , ) -> Result < ( ) > { // encode def levels match ( is_optional , validity ) { ( true , Some ( validity ) ) => encode_iter ( writer , validity . iter ( ) , version ) , ( true , None ) => encode_iter ( writer , std :: iter :: repeat ( true ) . take ( len ) , version ) , _ => Ok ( ( ) ) , // is required => no def levels } }
writes the def levels to a `Vec<u8>` and returns it.
writes the def levels to a ` Vec<u8 > ` and returns it .
writer
&mut Vec<u8>
is_optional
bool
validity
Option<&Bitmap>
len
usize
version
Version
writer
&mut Vec<u8>
is_optional
bool
validity
Option<&Bitmap>
len
usize
version
Version