nautilus_plugin/lib.rs
1// -------------------------------------------------------------------------------------------------
2// Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.
3// https://nautechsystems.io
4//
5// Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6// You may not use this file except in compliance with the License.
7// You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! Plug-in artifact identity and boundary primitives for NautilusTrader.
17//!
18//! This crate provides the public contract that lets an independently compiled
19//! Rust cdylib identify itself to a Nautilus host. It defines versioned build
20//! metadata, allocator-safe boundary values, opaque host tokens, and the
21//! `nautilus_plugin!` macro for exporting the standard entry symbol and
22//! manifest.
23
24#![warn(clippy::pedantic)]
25
26/// ABI version of the public plug-in metadata contract.
27///
28/// The host refuses to load a plug-in whose
29/// [`PluginManifest::abi_version`](crate::manifest::PluginManifest::abi_version)
30/// does not match this value.
31pub const NAUTILUS_PLUGIN_ABI_VERSION: u32 = 1;
32
33/// Schema version for [`manifest::PluginBuildId`].
34pub const PLUGIN_BUILD_ID_VERSION: u32 = 1;
35
36/// Name of the single `extern "C"` entry symbol every plug-in cdylib exports.
37pub const NAUTILUS_PLUGIN_INIT_SYMBOL: &[u8] = b"nautilus_plugin_init";
38
39pub mod boundary;
40pub mod host;
41pub mod manifest;
42pub mod panic;
43
44mod macros;
45
46pub use boundary::{BorrowedStr, OwnedBytes, PluginError, PluginErrorCode, PluginResult, Slice};
47pub use host::{HostContext, HostVTable};
48pub use manifest::{PluginBuildId, PluginInitFn, PluginManifest};
49
50/// Re-exports that plug-in crates typically want in scope.
51pub mod prelude {
52 pub use crate::{
53 BorrowedStr, HostContext, HostVTable, NAUTILUS_PLUGIN_ABI_VERSION, PluginBuildId,
54 PluginError, PluginErrorCode, PluginManifest, PluginResult, Slice,
55 };
56}