Skip to content

Commit

Permalink
chore: remove use of deprecated methods from amplify
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Aug 10, 2024
1 parent c3c5b78 commit 68e2f01
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rust/derive/tests/dumb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ fn dumb_enum_associated() -> common::Result {
fn dumb_ultra_complex() -> common::Result {
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, From)]
#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
#[strict_type(lib = TEST_LIB, dumb = NamedFields(confined_vec!(T::strict_dumb())))]
#[strict_type(lib = TEST_LIB, dumb = NamedFields(Confined::with(T::strict_dumb())))]
pub struct NamedFields<T: StrictDumb + StrictEncode + StrictDecode>(
Confined<Vec<T>, 1, { u8::MAX as usize }>,
);
Expand Down
6 changes: 3 additions & 3 deletions rust/src/stl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: u
for RString<C1, C, MIN, MAX>
{
type Target = AsciiString;
fn deref(&self) -> &Self::Target { self.s.as_inner() }
fn deref(&self) -> &Self::Target { self.s.as_unconfined() }
}

impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize> AsRef<[u8]>
Expand Down Expand Up @@ -161,7 +161,7 @@ impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: u
fn try_from(bytes: &[u8]) -> Result<Self, InvalidRString> {
if bytes.is_empty() && MIN == 0 {
return Ok(Self {
s: Confined::from_collection_unsafe(AsciiString::new()),
s: Confined::from_checked(AsciiString::new()),
first: PhantomData,
rest: PhantomData,
});
Expand Down Expand Up @@ -198,7 +198,7 @@ impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: u
impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize>
From<RString<C1, C, MIN, MAX>> for String
{
fn from(s: RString<C1, C, MIN, MAX>) -> Self { s.s.into_inner().into() }
fn from(s: RString<C1, C, MIN, MAX>) -> Self { s.s.release().into() }
}

impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize> Debug
Expand Down
2 changes: 1 addition & 1 deletion rust/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn encode<T: StrictEncode + Debug + Eq>(val: &T) -> Vec<u8> {
let data = val.strict_encode(ast_data).unwrap().unbox().unconfine();
Confined::<Vec<u8>, 0, MAX>::try_from(data)
.unwrap()
.into_inner()
.release()
}

pub fn decode<T: StrictDecode + Debug + Eq>(data: impl AsRef<[u8]>) -> T {
Expand Down

0 comments on commit 68e2f01

Please sign in to comment.