feat(ops): custom arity (#13949)

Also cleanup & drop ignored wildcard op-args
This commit is contained in:
Aaron O'Mullan 2022-03-14 23:38:53 +01:00 committed by GitHub
parent 9f494dc405
commit 88d0f01948
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 99 additions and 498 deletions

View file

@ -123,7 +123,6 @@ pub fn init<P: TimersPermission + 'static>(
fn op_base64_decode(
_: &mut OpState,
input: String,
_: (),
) -> Result<ZeroCopyBuf, AnyError> {
let mut input = input.into_bytes();
input.retain(|c| !c.is_ascii_whitespace());
@ -134,7 +133,6 @@ fn op_base64_decode(
fn op_base64_atob(
_: &mut OpState,
s: ByteString,
_: (),
) -> Result<ByteString, AnyError> {
let mut s = s.0;
s.retain(|c| !c.is_ascii_whitespace());
@ -188,17 +186,12 @@ fn b64_decode(input: &[u8]) -> Result<Vec<u8>, AnyError> {
fn op_base64_encode(
_: &mut OpState,
s: ZeroCopyBuf,
_: (),
) -> Result<String, AnyError> {
Ok(b64_encode(&s))
}
#[op]
fn op_base64_btoa(
_: &mut OpState,
s: ByteString,
_: (),
) -> Result<String, AnyError> {
fn op_base64_btoa(_: &mut OpState, s: ByteString) -> Result<String, AnyError> {
Ok(b64_encode(&s))
}
@ -220,7 +213,6 @@ struct DecoderOptions {
fn op_encoding_normalize_label(
_state: &mut OpState,
label: String,
_: (),
) -> Result<String, AnyError> {
let encoding = Encoding::for_label_no_replacement(label.as_bytes())
.ok_or_else(|| {
@ -236,7 +228,6 @@ fn op_encoding_normalize_label(
fn op_encoding_new_decoder(
state: &mut OpState,
options: DecoderOptions,
_: (),
) -> Result<ResourceId, AnyError> {
let DecoderOptions {
label,