#[repr(u8)]pub enum BufferStrategyKind {
PluginAllocated = 1,
Arena = 2,
}Expand description
Buffer management strategy for an interface.
Selected per-trait via #[plugin_interface(buffer = ...)].
Determines the FFI function pointer signatures in the vtable.
Discriminant value 0 is reserved (previously CallerAllocated, removed
in 0.1.0 — its value proposition was subsumed by PluginAllocated).
Variants§
PluginAllocated = 1
Plugin allocates output; host frees via PluginDescriptor::free_buffer.
VTable fns: (in_ptr, in_len, out_ptr, out_len) -> i32.
Arena = 2
Host provides a pre-allocated arena buffer; plugin writes its serialized
output into the buffer. Returns STATUS_BUFFER_TOO_SMALL (with needed
size written to out_len) if the arena is too small; host grows and
retries. Data is valid only until the next call.
VTable fns: (in_ptr, in_len, arena_ptr, arena_cap, out_offset, out_len) -> i32.
Arena is allocation-avoidance, not zero-copy. The plugin still
serializes its output (bincode-encoded by default) and copies the
bytes into the host-provided buffer; what Arena saves is the per-call
Box<[u8]> allocation that PluginAllocated incurs. For true byte
passthrough — the bytes themselves cross the boundary without an
encoding step — annotate the trait method with #[wire(raw)]. Raw
wire mode composes with both buffer strategies.
Trait Implementations§
Source§impl Clone for BufferStrategyKind
impl Clone for BufferStrategyKind
Source§fn clone(&self) -> BufferStrategyKind
fn clone(&self) -> BufferStrategyKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BufferStrategyKind
impl Debug for BufferStrategyKind
Source§impl Display for BufferStrategyKind
impl Display for BufferStrategyKind
Source§impl PartialEq for BufferStrategyKind
impl PartialEq for BufferStrategyKind
Source§fn eq(&self, other: &BufferStrategyKind) -> bool
fn eq(&self, other: &BufferStrategyKind) -> bool
self and other values to be equal, and is used by ==.impl Copy for BufferStrategyKind
impl Eq for BufferStrategyKind
impl StructuralPartialEq for BufferStrategyKind
Auto Trait Implementations§
impl Freeze for BufferStrategyKind
impl RefUnwindSafe for BufferStrategyKind
impl Send for BufferStrategyKind
impl Sync for BufferStrategyKind
impl Unpin for BufferStrategyKind
impl UnsafeUnpin for BufferStrategyKind
impl UnwindSafe for BufferStrategyKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.