pub enum ReturnKind {
Void,
MayContainResources,
AssumeNoResources,
}Expand description
Categorizes a function’s return for dispatch handling.
Determines how return values are processed during cross-plugin dispatch. Resources require special wrapping to track ownership across plugin boundaries, while plain data can be passed through directly.
§Choosing the Right Variant
When uncertain, use MayContainResources.
Using AssumeNoResources when resources are
actually present will cause resource handles to be passed through unwrapped
causing runtime exceptions.
AssumeNoResources is a performance optimization
that skips the wrapping step. Only use it when you are certain the return type
contains no resource handles anywhere in its structure (including nested within
records, variants, lists, etc.).
Variants§
Void
Function returns nothing (void).
MayContainResources
Function may return resource handles - always wraps safely.
Use this variant whenever resources might be present in the return value, or when you’re unsure. The performance overhead of wrapping is preferable to the undefined behavior caused by unwrapped resource handles.
AssumeNoResources
Assumes no resource handles are present - skips wrapping for performance.
Warning: Only use this if you are certain no resources are present.
If resources are returned but this variant is used, resource handles will
not be wrapped correctly, potentially causing undefined behavior in plugins.
When in doubt, use MayContainResources instead.
Trait Implementations§
Source§impl Clone for ReturnKind
impl Clone for ReturnKind
Source§fn clone(&self) -> ReturnKind
fn clone(&self) -> ReturnKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReturnKind
impl Debug for ReturnKind
Source§impl Default for ReturnKind
impl Default for ReturnKind
Source§fn default() -> ReturnKind
fn default() -> ReturnKind
Source§impl Display for ReturnKind
impl Display for ReturnKind
Source§impl Hash for ReturnKind
impl Hash for ReturnKind
Source§impl PartialEq for ReturnKind
impl PartialEq for ReturnKind
impl Copy for ReturnKind
impl Eq for ReturnKind
impl StructuralPartialEq for ReturnKind
Auto Trait Implementations§
impl Freeze for ReturnKind
impl RefUnwindSafe for ReturnKind
impl Send for ReturnKind
impl Sync for ReturnKind
impl Unpin for ReturnKind
impl UnsafeUnpin for ReturnKind
impl UnwindSafe for ReturnKind
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more