Skip to content

Commit

Permalink
feat: fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
JakkuSakura committed Apr 5, 2024
1 parent 448b7bd commit cd18081
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/array_string.rs
Expand Up @@ -638,22 +638,22 @@ impl<'de, const CAP: usize, LenType: LenUint> Deserialize<'de> for ArrayString<C

#[cfg(feature = "borsh")]
/// Requires crate feature `"borsh"`
impl<const CAP: usize> borsh::BorshSerialize for ArrayString<CAP> {
impl<const CAP: usize, LenType: LenUint> borsh::BorshSerialize for ArrayString<CAP, LenType> {
fn serialize<W: borsh::io::Write>(&self, writer: &mut W) -> borsh::io::Result<()> {
<str as borsh::BorshSerialize>::serialize(&*self, writer)
}
}

#[cfg(feature = "borsh")]
/// Requires crate feature `"borsh"`
impl<const CAP: usize> borsh::BorshDeserialize for ArrayString<CAP> {
impl<const CAP: usize, LenType: LenUint> borsh::BorshDeserialize for ArrayString<CAP, LenType> {
fn deserialize_reader<R: borsh::io::Read>(reader: &mut R) -> borsh::io::Result<Self> {
let len = <u32 as borsh::BorshDeserialize>::deserialize_reader(reader)? as usize;
if len > CAP {
return Err(borsh::io::Error::new(
borsh::io::ErrorKind::InvalidData,
format!("Expected a string no more than {} bytes long", CAP),
))
));
}

let mut buf = [0u8; CAP];
Expand Down
4 changes: 2 additions & 2 deletions src/arrayvec.rs
Expand Up @@ -1317,7 +1317,7 @@ impl<'de, T: Deserialize<'de>, const CAP: usize, LenType: LenUint> Deserialize<'

#[cfg(feature = "borsh")]
/// Requires crate feature `"borsh"`
impl<T, const CAP: usize> borsh::BorshSerialize for ArrayVec<T, CAP>
impl<T, const CAP: usize, LenType: LenUint> borsh::BorshSerialize for ArrayVec<T, CAP, LenType>
where
T: borsh::BorshSerialize,
{
Expand All @@ -1328,7 +1328,7 @@ impl<T, const CAP: usize> borsh::BorshSerialize for ArrayVec<T, CAP>

#[cfg(feature = "borsh")]
/// Requires crate feature `"borsh"`
impl<T, const CAP: usize> borsh::BorshDeserialize for ArrayVec<T, CAP>
impl<T, const CAP: usize, LenType: LenUint> borsh::BorshDeserialize for ArrayVec<T, CAP, LenType>
where
T: borsh::BorshDeserialize,
{
Expand Down
2 changes: 1 addition & 1 deletion tests/borsh.rs
Expand Up @@ -59,7 +59,7 @@ mod array_string {

#[test]
fn test_full() {
let string = ArrayString::from_byte_string(b"hello world").unwrap();
let string = ArrayString::<11>::from_byte_string(b"hello world").unwrap();
assert_ser(&string, b"\x0b\0\0\0hello world");
assert_roundtrip(&string);
}
Expand Down

0 comments on commit cd18081

Please sign in to comment.