pub trait PluginCustomData:
'static
+ Send
+ Sync
+ Sized {
const TYPE_NAME: &'static str;
// Required methods
fn ts_event(&self) -> u64;
fn ts_init(&self) -> u64;
fn to_json(&self) -> Result<Vec<u8>>;
fn from_json(payload: &[u8]) -> Result<Self>;
fn schema_ipc() -> Result<Vec<u8>>;
fn encode_batch(items: &[&Self]) -> Result<Vec<u8>>;
fn decode_batch(
ipc_bytes: &[u8],
metadata: &[(String, String)],
) -> Result<Vec<Self>>;
// Provided methods
fn equals(&self, other: &Self) -> bool
where Self: PartialEq { ... }
fn clone_value(&self) -> Self
where Self: Clone { ... }
}Expand description
Author-facing trait for a custom-data type contributed by a plug-in.
Plug-in authors implement this on their data struct; the
nautilus_plugin! macro generates the
extern "C" thunks that adapt this trait to a CustomDataVTable.
All trait methods run inside crate::panic::guard in the generated
thunks, so a panic surfaces as a PluginError with code
PluginErrorCode::Panic instead of unwinding through the FFI.
Required Associated Constants§
Required Methods§
Sourcefn to_json(&self) -> Result<Vec<u8>>
fn to_json(&self) -> Result<Vec<u8>>
Serializes this value to a JSON payload (no envelope, payload only).
Sourcefn from_json(payload: &[u8]) -> Result<Self>
fn from_json(payload: &[u8]) -> Result<Self>
Deserializes a value from a JSON payload (no envelope).
Sourcefn schema_ipc() -> Result<Vec<u8>>
fn schema_ipc() -> Result<Vec<u8>>
Returns the Arrow schema for this type as an Arrow IPC byte stream.
Sourcefn encode_batch(items: &[&Self]) -> Result<Vec<u8>>
fn encode_batch(items: &[&Self]) -> Result<Vec<u8>>
Encodes a batch of values into an Arrow IPC byte stream.
Provided Methods§
Sourcefn equals(&self, other: &Self) -> boolwhere
Self: PartialEq,
fn equals(&self, other: &Self) -> boolwhere
Self: PartialEq,
Tests two values of this type for equality. Default implementation
requires PartialEq; override if a custom comparison is needed.
Sourcefn clone_value(&self) -> Selfwhere
Self: Clone,
fn clone_value(&self) -> Selfwhere
Self: Clone,
Clones the value into a new heap allocation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".