Skip to main content

fidius_core/
status.rs

1// Copyright 2026 Colliery, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
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//! FFI status codes returned by plugin method shims.
16//!
17//! These `i32` values are the return type of every `extern "C"` function
18//! in a plugin vtable. The host checks the status code before reading
19//! the output buffer.
20
21/// Method executed successfully. Output buffer contains the serialized result.
22pub const STATUS_OK: i32 = 0;
23
24/// Output buffer was too small (CallerAllocated/Arena strategies only).
25/// The `out_len` parameter contains the required size. Retry with a larger buffer.
26pub const STATUS_BUFFER_TOO_SMALL: i32 = -1;
27
28/// Serialization or deserialization failed at the FFI boundary.
29/// This indicates a bug in the generated shims or a type mismatch.
30pub const STATUS_SERIALIZATION_ERROR: i32 = -2;
31
32/// The plugin method returned an error. The output buffer contains a
33/// serialized `PluginError` with details.
34pub const STATUS_PLUGIN_ERROR: i32 = -3;
35
36/// A panic was caught at the `extern "C"` boundary via `catch_unwind`.
37/// The output buffer may contain a panic message string, but this is not guaranteed.
38pub const STATUS_PANIC: i32 = -4;