fn encode(&self, buf: &mut Vec<u8>) {
        match self {
            // Data = 0x00 || LE32(len) || <bytes>
            PortableItem::Data(d) => {
                encoding::write_u8(DATA_TYPE, buf);
                encoding::write_u32(d.serialized_length() as u32, buf);
                d.encode(buf);
            }
            // Value = 0x01 || <32 bytes> || <32 bytes>
            PortableItem::Value(v) => {
                encoding::write_u8(VALUE_TYPE, buf);
                encoding::write_point(&v.qty.to_point(), buf);
                encoding::write_point(&v.flv.to_point(), buf);
            }
        }
    }
/// Serializes the contract to a byte array
Serializes the contract to a byte array
Serializes the contract to a byte array
fn encode(&self, buf: &mut Vec<u8>) {
        match self {
            // Data = 0x00 || LE32(len) || <bytes>
            PortableItem::Data(d) => {
                encoding::write_u8(DATA_TYPE, buf);
                encoding::write_u32(d.serialized_length() as u32, buf);
                d.encode(buf);
            }
            // Value = 0x01 || <32 bytes> || <32 bytes>
            PortableItem::Value(v) => {
                encoding::write_u8(VALUE_TYPE, buf);
                encoding::write_point(&v.qty.to_point(), buf);
                encoding::write_point(&v.flv.to_point(), buf);
            }
        }
    }
fn encode ( & self , buf : & mut Vec < u8 > ) { match self { // Data = 0x00 || LE32(len) || <bytes> PortableItem :: Data ( d ) => { encoding :: write_u8 ( DATA_TYPE , buf ) ; encoding :: write_u32 ( d . serialized_length ( ) as u32 , buf ) ; d . encode ( buf ) ; } // Value = 0x01 || <32 bytes> || <32 bytes> PortableItem :: Value ( v ) => { encoding :: write_u8 ( VALUE_TYPE , buf ) ; encoding :: write_point ( & v . qty . to_point ( ) , buf ) ; encoding :: write_point ( & v . flv . to_point ( ) , buf ) ; } } }
Serializes the contract to a byte array
Serializes the contract to a byte array
&self
buf
&mut Vec<u8>
&self
buf
&mut Vec<u8>