[−][src]Crate pinecone
Pinecone, a minimalistic no_std
+ alloc
serde format
Works just like any other normal serde:
use pinecone::{from_bytes, to_slice, to_vec}; use serde::{Deserialize, Serialize}; #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] struct Example { foo: String, bar: Option<u32>, zot: bool, } let original = Example { foo: "Vec test".to_string(), bar: Some(0x1337), zot: true, }; let bytes: Vec<u8> = to_vec(&original).expect("Serialization failed"); assert_eq!(from_bytes(&bytes), Ok(original)); let original = Example { foo: "Slice test".to_string(), bar: Some(0x1337), zot: true, }; let mut buffer = [0; 1024]; to_slice(&original, &mut buffer).expect("Serialization failed"); assert_eq!(from_bytes(&buffer), Ok(original));
Structs
Deserializer | A structure for deserializing a pinecone message |
Serializer | A |
Enums
Error | This is the error type used by Pinecone |
Functions
from_bytes | Deserialize a message of type |
take_from_bytes | Deserialize a message of type |
to_slice | Serialize a |
to_vec | Serialize a |
Type Definitions
Result | This is the Result type used by Pinecone. |