Skip to content

Commit

Permalink
Merge pull request #1018 from lcswillems/master
Browse files Browse the repository at this point in the history
Add `.concat()` method to ManagedBuffer
  • Loading branch information
andrei-marinica authored Mar 17, 2023
2 parents 86f7f97 + 501f8a5 commit 860031c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions framework/base/src/types/managed/basic/managed_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ impl<M: ManagedTypeApi> ManagedBuffer<M> {
M::managed_type_impl().mb_append_bytes(self.handle.clone(), &item.to_be_bytes()[..]);
}

/// Concatenates 2 managed buffers. Consumes both arguments in the process.
#[inline]
#[must_use]
pub fn concat(mut self, other: ManagedBuffer<M>) -> Self {
self.append(&other);
self
}

/// Convenience method for quickly getting a top-decoded u64 from the managed buffer.
///
/// TODO: remove this method once TopDecodeInput is implemented for ManagedBuffer reference.
Expand Down

0 comments on commit 860031c

Please sign in to comment.