pub trait Serializeable: Sized {
    fn to_bytes(&self) -> Result<Bytes>;
    fn from_bytes_with_registry(
        bytes: &[u8],
        registry: &dyn FunctionRegistry
    ) -> Result<Self>; fn from_bytes(bytes: &[u8]) -> Result<Self> { ... } }
Expand description

Encodes something (such as Expr) to/from a stream of bytes.

use datafusion_expr::{col, lit, Expr};
use datafusion_proto::bytes::Serializeable;

// Create a new `Expr` a < 32
let expr = col("a").lt(lit(5i32));

// Convert it to an opaque form
let bytes = expr.to_bytes().unwrap();

// Decode bytes from somewhere (over network, etc.
let decoded_expr = Expr::from_bytes(&bytes).unwrap();
assert_eq!(expr, decoded_expr);

Required Methods§

Convert self to an opaque byt stream

Convert bytes (the output of [to_bytes] back into an object resolving user defined functions with the specified registry

Provided Methods§

Convert bytes (the output of [to_bytes] back into an object. This will error if the serialized bytes contain any user defined functions, in which case use [from_bytes_with_registry]

Implementations on Foreign Types§

Implementors§