Back to Deno

Valid Args

libs/ops/op2/valid_args.md

2.7.1420.4 KB
Original Source
SupportedRustFastcallV8Notes
XboolXBool
Xi8XUint32, Int32, Number, BigInt
Xu8XUint32, Int32, Number, BigInt
Xi16XUint32, Int32, Number, BigInt
Xu16XUint32, Int32, Number, BigInt
Xi32XUint32, Int32, Number, BigInt
Xu32XUint32, Int32, Number, BigInt
X#[smi] ResourceIdXUint32, Int32, Number, BigIntSMI is internally represented as a signed integer, but unsigned #[smi] types will be bit-converted to unsigned values for the Rust call. JavaScript code will continue to see signed integers.
X#[bigint] i64XUint32, Int32, Number, BigInt
X#[bigint] u64XUint32, Int32, Number, BigInt
X#[bigint] isizeXUint32, Int32, Number, BigInt
X#[bigint] usizeXUint32, Int32, Number, BigInt
Xf32XUint32, Int32, Number, BigInt
Xf64XUint32, Int32, Number, BigInt
X#[string] StringXStringFastcall available only if string is Latin-1. Will always create an allocated, UTF-8 copy of the String data.
X#[string] &strXStringFastcall available only if string is Latin-1. Will create an owned String copy of the String data if it doesn't fit on the stack. Will never allocate in a fastcall, but will copy Latin-1 -> UTF-8.
X#[string] Cow<str>XStringFastcall available only if string is Latin-1. Will create a Cow::Owned copy of the String data if it doesn't fit on the stack. Will always be Cow::Borrowed in a fastcall, but will copy Latin-1 -> UTF-8.
X#[string(onebyte)] Cow<[u8]>XStringFastest String-type method. If the string is not Latin-1, will throw a TypeError.
X&v8::ValueXany
X&v8::V8XV8
Xv8::Localv8::ValueXany
Xv8::Localv8::**V8**XV8
XFromV8ScopelessanyAny type that implements deno_core::covert::FromV8Scopeless.
X#[scoped] FromV8TypeanyAny type that implements deno_core::covert::FromV8. ⚠️ May be slow.
X#[scoped] (Tuple, Tuple)anyAny type that implements deno_core::covert::FromV8. ⚠️ May be slow.
X#[serde] SerdeTypeany⚠️ May be slow. Legacy & not recommended, use FromV8 trait and macros instead.
X#[serde] (Tuple, Tuple)any⚠️ May be slow. Legacy & not recommended, use FromV8 trait and macros instead.
#[anybuffer] &mut [u8]XArrayBuffer, ArrayBufferView (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly.
#[anybuffer] &[u8]XArrayBuffer, ArrayBufferView (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly.
#[anybuffer] *mut u8XArrayBuffer, ArrayBufferView (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null.
#[anybuffer] *const u8XArrayBuffer, ArrayBufferView (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null.
X#[arraybuffer] &mut [u8]XArrayBuffer (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly.
X#[arraybuffer] &[u8]XArrayBuffer (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly.
X#[arraybuffer] *mut u8XArrayBuffer (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null.
X#[arraybuffer] *const u8XArrayBuffer (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null.
X#[arraybuffer(copy)] Vec<u8>XArrayBuffer (resizable=true,false)Safe, but forces a copy.
X#[arraybuffer(copy)] Box<[u8]>XArrayBuffer (resizable=true,false)Safe, but forces a copy.
X#[arraybuffer(copy)] bytes::BytesXArrayBuffer (resizable=true,false)Safe, but forces a copy.
#[buffer] &mut [u8]XUInt8Array (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly.
#[buffer] &[u8]XUInt8Array (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly.
#[buffer] *mut u8XUInt8Array (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null.
#[buffer] *const u8XUInt8Array (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly. Because of how V8 treats empty arrays in fastcalls, they will always be passed as null.
X#[buffer(copy)] Vec<u8>XUInt8Array (resizable=true,false)Safe, but forces a copy.
X#[buffer(copy)] Box<[u8]>XUInt8Array (resizable=true,false)Safe, but forces a copy.
X#[buffer(copy)] bytes::BytesXUInt8Array (resizable=true,false)Safe, but forces a copy.
X#[buffer] &mut [u32]XUInt32Array (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly.
X#[buffer] &[u32]XUInt32Array (resizable=true,false)⚠️ JS may modify the contents of the slice if V8 is called re-entrantly.
X#[buffer(copy)] Vec<u32>XUInt32Array (resizable=true,false)Safe, but forces a copy.
X#[buffer(copy)] Box<[u32]>XUInt32Array (resizable=true,false)Safe, but forces a copy.
#[buffer] V8SliceXArrayBufferView (resizable=false)⚠️ JS may modify the contents of slices obtained from buffer.
#[buffer(detach)] V8SliceXArrayBufferView (resizable=true,false)Safe.
#[buffer] V8ResizableSliceXArrayBufferView (resizable=true)⚠️ JS may modify the contents of slices obtained from buffer.
#[buffer] JsBufferXArrayBufferView (resizable=false)⚠️ JS may modify the contents of slices obtained from buffer.
X#[buffer(detach)] JsBufferArrayBufferView (resizable=true,false)Safe.
#[buffer(unsafe)] bytes::BytesXArrayBufferView (resizable=false)⚠️ JS may modify the contents of the buffer.
#[buffer(detach)] bytes::BytesXArrayBufferView (resizable=true,false)Safe.
X*const std::ffi::c_voidXExternal
X*mut std::ffi::c_voidXExternal
X&OpStateX
X&mut OpStateX
XRc<RefCell<OpState>>X
X&JsRuntimeStateXOnly usable in deno_core.