Skip to content

Commit

Permalink
Fix param of Type::from_xdr_base64 (stellar#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch authored Nov 13, 2023
1 parent cbff4b3 commit 70a8851
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/xdrgen/generators/rust.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def render_enum_of_all_types(out, types)
}
#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
2 changes: 1 addition & 1 deletion spec/output/generator_spec_rust/block_comments.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2925,7 +2925,7 @@ impl Type {
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
2 changes: 1 addition & 1 deletion spec/output/generator_spec_rust/const.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2860,7 +2860,7 @@ TypeVariant::TestArray2 => Box::new(ReadXdrIter::<_, TestArray2>::new(dec, r.lim
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
2 changes: 1 addition & 1 deletion spec/output/generator_spec_rust/enum.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3245,7 +3245,7 @@ TypeVariant::Color2 => Box::new(ReadXdrIter::<_, Color2>::new(dec, r.limits.clon
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
2 changes: 1 addition & 1 deletion spec/output/generator_spec_rust/nesting.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3185,7 +3185,7 @@ TypeVariant::MyUnionTwo => Box::new(ReadXdrIter::<_, MyUnionTwo>::new(dec, r.lim
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
2 changes: 1 addition & 1 deletion spec/output/generator_spec_rust/optional.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,7 @@ TypeVariant::HasOptions => Box::new(ReadXdrIter::<_, HasOptions>::new(dec, r.lim
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
2 changes: 1 addition & 1 deletion spec/output/generator_spec_rust/struct.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,7 @@ TypeVariant::MyStruct => Box::new(ReadXdrIter::<_, MyStruct>::new(dec, r.limits.
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
2 changes: 1 addition & 1 deletion spec/output/generator_spec_rust/test.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4659,7 +4659,7 @@ TypeVariant::NesterNestedUnion => Box::new(ReadXdrIter::<_, NesterNestedUnion>::
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
2 changes: 1 addition & 1 deletion spec/output/generator_spec_rust/union.x/MyXDR.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3268,7 +3268,7 @@ TypeVariant::IntUnion2 => Box::new(ReadXdrIter::<_, IntUnion2>::new(dec, r.limit
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2925,7 +2925,7 @@ impl Type {
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2860,7 +2860,7 @@ TypeVariant::TestArray2 => Box::new(ReadXdrIter::<_, TestArray2>::new(dec, r.lim
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3245,7 +3245,7 @@ TypeVariant::Color2 => Box::new(ReadXdrIter::<_, Color2>::new(dec, r.limits.clon
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3185,7 +3185,7 @@ TypeVariant::MyUnionTwo => Box::new(ReadXdrIter::<_, MyUnionTwo>::new(dec, r.lim
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,7 @@ TypeVariant::HasOptions => Box::new(ReadXdrIter::<_, HasOptions>::new(dec, r.lim
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,7 @@ TypeVariant::MyStruct => Box::new(ReadXdrIter::<_, MyStruct>::new(dec, r.limits.
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4659,7 +4659,7 @@ TypeVariant::NesterNestedUnion => Box::new(ReadXdrIter::<_, NesterNestedUnion>::
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3268,7 +3268,7 @@ TypeVariant::IntUnion2 => Box::new(ReadXdrIter::<_, IntUnion2>::new(dec, r.limit
}

#[cfg(feature = "base64")]
pub fn from_xdr_base64(v: TypeVariant, b64: String, limits: Limits) -> Result<Self> {
pub fn from_xdr_base64(v: TypeVariant, b64: impl AsRef<[u8]>, limits: Limits) -> Result<Self> {
let mut b64_reader = Cursor::new(b64);
let mut dec = Limited::new(base64::read::DecoderReader::new(&mut b64_reader, base64::STANDARD), limits);
let t = Self::read_xdr_to_end(v, &mut dec)?;
Expand Down

0 comments on commit 70a8851

Please sign in to comment.