From bd481bf095f920a419ea55543f911e087f98f36f Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Wed, 16 Mar 2022 00:33:46 +0100 Subject: feat(ops): optional OpState (#13954) --- ext/web/lib.rs | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'ext/web/lib.rs') diff --git a/ext/web/lib.rs b/ext/web/lib.rs index 75e619dfe..d199b7bfe 100644 --- a/ext/web/lib.rs +++ b/ext/web/lib.rs @@ -121,20 +121,14 @@ pub fn init( } #[op] -fn op_base64_decode( - _: &mut OpState, - input: String, -) -> Result { +fn op_base64_decode(input: String) -> Result { let mut input = input.into_bytes(); input.retain(|c| !c.is_ascii_whitespace()); Ok(b64_decode(&input)?.into()) } #[op] -fn op_base64_atob( - _: &mut OpState, - s: ByteString, -) -> Result { +fn op_base64_atob(s: ByteString) -> Result { let mut s = s.0; s.retain(|c| !c.is_ascii_whitespace()); @@ -184,15 +178,12 @@ fn b64_decode(input: &[u8]) -> Result, AnyError> { } #[op] -fn op_base64_encode( - _: &mut OpState, - s: ZeroCopyBuf, -) -> Result { +fn op_base64_encode(s: ZeroCopyBuf) -> Result { Ok(b64_encode(&s)) } #[op] -fn op_base64_btoa(_: &mut OpState, s: ByteString) -> Result { +fn op_base64_btoa(s: ByteString) -> Result { Ok(b64_encode(&s)) } @@ -211,10 +202,7 @@ struct DecoderOptions { } #[op] -fn op_encoding_normalize_label( - _state: &mut OpState, - label: String, -) -> Result { +fn op_encoding_normalize_label(label: String) -> Result { let encoding = Encoding::for_label_no_replacement(label.as_bytes()) .ok_or_else(|| { range_error(format!( @@ -331,7 +319,6 @@ struct EncodeIntoResult { #[op] fn op_encoding_encode_into( - _state: &mut OpState, input: String, mut buffer: ZeroCopyBuf, ) -> Result { -- cgit v1.2.3