pub fn serialize(t: &Target, p: &Prog, buf: &mut [u8]) -> Result<usize, SerializeError> {
    let mut ctx = ExecCtx {
        target: t,
        buf,
        res_args: FxHashMap::default(),
        copyout_seq: 0,
        eof: false,
    };
    for call in &p.calls {
        ctx.serialize_call(call);
    }
    ctx.write_u64(EXEC_INSTR_EOF);
    if !ctx.buf.has_remaining_mut() || ctx.eof {
        Err(SerializeError::BufferTooSmall {
            provided: buf.len(),
        })
    } else {
        Ok(ctx.buf.remaining_mut())
    }
}
/// Serialize a prog into packed binary format.
Serialize a prog into packed binary format.
Serialize a prog into packed binary format .
pub fn serialize(t: &Target, p: &Prog, buf: &mut [u8]) -> Result<usize, SerializeError> {
    let mut ctx = ExecCtx {
        target: t,
        buf,
        res_args: FxHashMap::default(),
        copyout_seq: 0,
        eof: false,
    };
    for call in &p.calls {
        ctx.serialize_call(call);
    }
    ctx.write_u64(EXEC_INSTR_EOF);
    if !ctx.buf.has_remaining_mut() || ctx.eof {
        Err(SerializeError::BufferTooSmall {
            provided: buf.len(),
        })
    } else {
        Ok(ctx.buf.remaining_mut())
    }
}
pub fn serialize ( t : & Target , p : & Prog , buf : & mut [ u8 ] ) -> Result < usize , SerializeError > { let mut ctx = ExecCtx { target : t , buf , res_args : FxHashMap :: default ( ) , copyout_seq : 0 , eof : false , } ; for call in & p . calls { ctx . serialize_call ( call ) ; } ctx . write_u64 ( EXEC_INSTR_EOF ) ; if ! ctx . buf . has_remaining_mut ( ) || ctx . eof { Err ( SerializeError :: BufferTooSmall { provided : buf . len ( ) , } ) } else { Ok ( ctx . buf . remaining_mut ( ) ) } }
Serialize a prog into packed binary format.
Serialize a prog into packed binary format .
t
&Target
p
&Prog
buf
&mut [u8]
t
&Target
p
&Prog
buf
&mut [u8]