/// A safe rust wrapper for the fastboot_process() API
A safe rust wrapper for the fastboot_process() API
A safe rust wrapper for the fastboot_process () API
pub async fn fastboot_process_safe<T: Read + Write>(
    stream: &mut T,
    packet_size: usize,
) -> Result<(), anyhow::Error> {
    // Process the new packet
    let ret = unsafe {
        fastboot_process(
            packet_size.try_into().unwrap(),
            Some(read_packet_callback::<T>),
            Some(write_packet_callback::<T>),
            stream as *mut T as *mut void,
        )
    };
    match ret {
        0 => Ok(()),
        _ => {
            return Err(anyhow::format_err!("Failed to process packet. {}", ret));
        }
    }
}
pub async fn fastboot_process_safe < T : Read + Write > ( stream : & mut T , packet_size : usize , ) -> Result < ( ) , anyhow :: Error > { // Process the new packet let ret = unsafe { fastboot_process ( packet_size . try_into ( ) . unwrap ( ) , Some ( read_packet_callback :: < T > ) , Some ( write_packet_callback :: < T > ) , stream as * mut T as * mut void , ) } ; match ret { 0 => Ok ( ( ) ) , _ => { return Err ( anyhow :: format_err ! ( " " ret ) ) ; } } }
A safe rust wrapper for the fastboot_process() API
A safe rust wrapper for the fastboot_process () API
stream
&mut T
packet_size
usize