pub fn encode_encodable_iter<Iter, T>(
    encoder: &mut Encoder<'_>,
    iter_opt: Option<Iter>,
) -> Result<()>
where
    Iter: ExactSizeIterator<Item = T>,
    T: Encodable,
{
    match iter_opt {
        None => encode_absent_vector(encoder),
        Some(iter) => {
            // Two u64: (len, present)
            (iter.len() as u64).encode(encoder)?;
            ALLOC_PRESENT_U64.encode(encoder)?;
            if iter.len() == 0 {
                return Ok(());
            }
            let bytes_len = iter.len() * encoder.inline_size_of::<T>();
            encoder.write_out_of_line(bytes_len, |encoder| {
                encoder.recurse(|encoder| {
                    for mut item in iter {
                        item.encode(encoder)?;
                    }
                    Ok(())
                })
            })
        }
    }
}
/// Encode an optional iterator over encodable elements into a FIDL vector-like representation.
Encode an optional iterator over encodable elements into a FIDL vector-like representation.
Encode an optional iterator over encodable elements into a FIDL vector - like representation .
pub fn encode_encodable_iter<Iter, T>(
    encoder: &mut Encoder<'_>,
    iter_opt: Option<Iter>,
) -> Result<()>
where
    Iter: ExactSizeIterator<Item = T>,
    T: Encodable,
{
    match iter_opt {
        None => encode_absent_vector(encoder),
        Some(iter) => {
            // Two u64: (len, present)
            (iter.len() as u64).encode(encoder)?;
            ALLOC_PRESENT_U64.encode(encoder)?;
            if iter.len() == 0 {
                return Ok(());
            }
            let bytes_len = iter.len() * encoder.inline_size_of::<T>();
            encoder.write_out_of_line(bytes_len, |encoder| {
                encoder.recurse(|encoder| {
                    for mut item in iter {
                        item.encode(encoder)?;
                    }
                    Ok(())
                })
            })
        }
    }
}
pub fn encode_encodable_iter < Iter , T > ( encoder : & mut Encoder < ' _ > , iter_opt : Option < Iter > , ) -> Result < ( ) > where Iter : ExactSizeIterator < Item = T > , T : Encodable , { match iter_opt { None => encode_absent_vector ( encoder ) , Some ( iter ) => { // Two u64: (len, present) ( iter . len ( ) as u64 ) . encode ( encoder ) ? ; ALLOC_PRESENT_U64 . encode ( encoder ) ? ; if iter . len ( ) == 0 { return Ok ( ( ) ) ; } let bytes_len = iter . len ( ) * encoder . inline_size_of :: < T > ( ) ; encoder . write_out_of_line ( bytes_len , | encoder | { encoder . recurse ( | encoder | { for mut item in iter { item . encode ( encoder ) ? ; } Ok ( ( ) ) } ) } ) } } }
Encode an optional iterator over encodable elements into a FIDL vector-like representation.
Encode an optional iterator over encodable elements into a FIDL vector - like representation .
encoder
&mut Encoder<'_>
iter_opt
Option<Iter>