pub struct InvalidReturnValue {
pub value_type: ValueType,
}Expand description
Used as the fallback branch in Either<Ret, InvalidReturnValue> to catch
type mismatches from JS function options. Always passes NAPI validation so
that when Ret validation fails, the error is handled in Rust with a clear
message instead of becoming an uncatchable napi_fatal_exception.
Fields§
§value_type: ValueTypeTrait Implementations§
Source§impl FromNapiValue for InvalidReturnValue
impl FromNapiValue for InvalidReturnValue
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
This function called to convert napi values to native rust values Read more
fn from_unknown(value: Unknown<'_>) -> Result<Self, Error>
Source§impl TypeName for InvalidReturnValue
impl TypeName for InvalidReturnValue
Source§impl ValidateNapiValue for InvalidReturnValue
impl ValidateNapiValue for InvalidReturnValue
Source§unsafe fn validate(_env: napi_env, _napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(_env: napi_env, _napi_val: napi_value) -> Result<napi_value>
This function called to validate whether napi value passed to rust is valid type. Read more
Auto Trait Implementations§
impl Freeze for InvalidReturnValue
impl RefUnwindSafe for InvalidReturnValue
impl Send for InvalidReturnValue
impl Sync for InvalidReturnValue
impl Unpin for InvalidReturnValue
impl UnsafeUnpin for InvalidReturnValue
impl UnwindSafe for InvalidReturnValue
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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