Skip to content

Commit

Permalink
fix: impl SerializeWith for Lock
Browse files Browse the repository at this point in the history
  • Loading branch information
leruaa committed Nov 21, 2024
1 parent 7c64f43 commit f63ad7f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion utils/client/src/oracle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use kona_preimage::{
use kona_proof::FlushableCache;
use kzg_rs::{get_kzg_settings, Blob as KzgRsBlob, Bytes48};
use rkyv::{
with::{ArchiveWith, DeserializeWith},
with::{ArchiveWith, DeserializeWith, SerializeWith},
Archive, Archived, Deserialize, Fallible, Infallible, Resolver, Serialize,
};
use sha2::{Digest, Sha256};
Expand Down Expand Up @@ -211,6 +211,19 @@ impl<F: Archive> ArchiveWith<Arc<Mutex<F>>> for Lock {
}
}

impl<S, T> SerializeWith<Arc<Mutex<T>>, S> for Lock
where
T: Serialize<S>,
S: Fallible + ?Sized,
{
fn serialize_with(
field: &Arc<Mutex<T>>,
serializer: &mut S,
) -> Result<Self::Resolver, <S as Fallible>::Error> {
field.lock().serialize(serializer)
}
}

impl<D, T> DeserializeWith<Archived<T>, Arc<Mutex<T>>, D> for Lock
where
Archived<T>: Deserialize<T, D>,
Expand Down

0 comments on commit f63ad7f

Please sign in to comment.