diff --git a/ipa-core/src/app.rs b/ipa-core/src/app.rs index 9a90a8a49..0ca99287d 100644 --- a/ipa-core/src/app.rs +++ b/ipa-core/src/app.rs @@ -115,7 +115,7 @@ impl HelperApp { .query_processor .complete(query_id) .await? - .as_bytes()) + .to_bytes()) } } diff --git a/ipa-core/src/helpers/transport/handler.rs b/ipa-core/src/helpers/transport/handler.rs index f0e0f0bb7..42981d097 100644 --- a/ipa-core/src/helpers/transport/handler.rs +++ b/ipa-core/src/helpers/transport/handler.rs @@ -137,7 +137,7 @@ impl From for HelperResponse { impl> From for HelperResponse { fn from(value: R) -> Self { - let v = value.as_ref().as_bytes(); + let v = value.as_ref().to_bytes(); Self { body: v } } } diff --git a/ipa-core/src/net/client/mod.rs b/ipa-core/src/net/client/mod.rs index 2d49d4e28..795457718 100644 --- a/ipa-core/src/net/client/mod.rs +++ b/ipa-core/src/net/client/mod.rs @@ -658,7 +658,7 @@ pub(crate) mod tests { results.to_vec(), [Replicated::from((expected_results[0], expected_results[1]))] .to_vec() - .as_bytes() + .to_bytes() ); } } diff --git a/ipa-core/src/net/server/handlers/query/create.rs b/ipa-core/src/net/server/handlers/query/create.rs index 2d46f043b..3fc7bc641 100644 --- a/ipa-core/src/net/server/handlers/query/create.rs +++ b/ipa-core/src/net/server/handlers/query/create.rs @@ -2,7 +2,7 @@ use axum::{routing::post, Extension, Json, Router}; use hyper::StatusCode; use crate::{ - helpers::{ApiError::NewQuery, BodyStream, Transport}, + helpers::{ApiError, BodyStream, Transport}, net::{http_serde, Error, HttpTransport}, query::NewQueryError, sync::Arc, @@ -20,7 +20,7 @@ async fn handler( .await { Ok(resp) => Ok(Json(resp.try_into()?)), - Err(err @ NewQuery(NewQueryError::State { .. })) => { + Err(err @ ApiError::NewQuery(NewQueryError::State { .. })) => { Err(Error::application(StatusCode::CONFLICT, err)) } Err(err) => Err(Error::application(StatusCode::INTERNAL_SERVER_ERROR, err)), diff --git a/ipa-core/src/net/server/handlers/query/results.rs b/ipa-core/src/net/server/handlers/query/results.rs index 020c157c1..8e6cad2f6 100644 --- a/ipa-core/src/net/server/handlers/query/results.rs +++ b/ipa-core/src/net/server/handlers/query/results.rs @@ -80,7 +80,7 @@ mod tests { let results = handler(Extension(test_server.transport), req.clone()) .await .unwrap(); - assert_eq!(results, expected_results.as_bytes()); + assert_eq!(results, expected_results.to_bytes()); } struct OverrideReq { diff --git a/ipa-core/src/query/executor.rs b/ipa-core/src/query/executor.rs index 409c6c8f5..c5977e7df 100644 --- a/ipa-core/src/query/executor.rs +++ b/ipa-core/src/query/executor.rs @@ -36,7 +36,7 @@ use crate::{ }; pub trait Result: Send + Debug { - fn as_bytes(&self) -> Vec; + fn to_bytes(&self) -> Vec; } impl Result for Vec @@ -44,7 +44,7 @@ where T: Serializable, Vec: Debug + Send, { - fn as_bytes(&self) -> Vec { + fn to_bytes(&self) -> Vec { let mut r = vec![0u8; self.len() * T::Size::USIZE]; for (i, row) in self.iter().enumerate() { row.serialize(GenericArray::from_mut_slice( @@ -156,7 +156,7 @@ mod tests { fn serialize_result() { let [input, ..] = (0u128..=3).map(Fp31::truncate_from).share(); let expected = input.clone(); - let bytes = &input.as_bytes(); + let bytes = &input.to_bytes(); assert_eq!( expected, AdditiveShare::::from_byte_slice(bytes)