Skip to main content

serialize

Function serialize 

Source
pub fn serialize<T: Serialize>(value: &T) -> NeoResult<Vec<u8>>
Expand description

Serializes a value to bytes using bincode.

§Type Parameters

  • T - The type to serialize, must implement Serialize

§Arguments

  • value - A reference to the value to serialize

§Returns

  • Ok(Vec<u8>) - The serialized bytes on success
  • Err(NeoError) - If serialization fails

§Examples

use neo_devpack::codec::serialize;

let value = 42i32;
let bytes = serialize(&value).unwrap();