pub struct PrefixedVec<L, T> { /* private fields */ }
Expand description
PrefixedVec allows overriding the default u8 size of the length prefix for a Vec.
This is useful when the size of a Vec is greater than 255 and we wish to override the
Pyth serialization logic to use a u16 etc instead. This works by serializing the Vec
as a struct with a len field with the overridden type, when combined with PrefixlessVec
below the combination of { "len": L, "data": [T] }
is serialized as expected in the
wire format.
For non-Pyth formats this results in a struct which is the correct way to interpret our data on chain anyway.
Implementations§
Trait Implementations§
Source§impl<L, T> AsRef<Vec<T>> for PrefixedVec<L, T>
impl<L, T> AsRef<Vec<T>> for PrefixedVec<L, T>
Source§impl<L, T> BorshDeserialize for PrefixedVec<L, T>
impl<L, T> BorshDeserialize for PrefixedVec<L, T>
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl<L, T> BorshSerialize for PrefixedVec<L, T>
impl<L, T> BorshSerialize for PrefixedVec<L, T>
Source§impl<L: Clone, T: Clone> Clone for PrefixedVec<L, T>
impl<L: Clone, T: Clone> Clone for PrefixedVec<L, T>
Source§fn clone(&self) -> PrefixedVec<L, T>
fn clone(&self) -> PrefixedVec<L, T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'de, L, T> Deserialize<'de> for PrefixedVec<L, T>
impl<'de, L, T> Deserialize<'de> for PrefixedVec<L, T>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl<L, T> From<PrefixedVec<L, T>> for Vec<T>
impl<L, T> From<PrefixedVec<L, T>> for Vec<T>
Source§fn from(data: PrefixedVec<L, T>) -> Self
fn from(data: PrefixedVec<L, T>) -> Self
Converts to this type from the input type.
Source§impl<L, T> From<Vec<T>> for PrefixedVec<L, T>
impl<L, T> From<Vec<T>> for PrefixedVec<L, T>
Source§impl<L, T> IntoIterator for PrefixedVec<L, T>
impl<L, T> IntoIterator for PrefixedVec<L, T>
Source§impl<L: PartialOrd, T: PartialOrd> PartialOrd for PrefixedVec<L, T>
impl<L: PartialOrd, T: PartialOrd> PartialOrd for PrefixedVec<L, T>
Source§impl<L, T> Serialize for PrefixedVec<L, T>
impl<L, T> Serialize for PrefixedVec<L, T>
impl<L, T> StructuralPartialEq for PrefixedVec<L, T>
Auto Trait Implementations§
impl<L, T> Freeze for PrefixedVec<L, T>
impl<L, T> RefUnwindSafe for PrefixedVec<L, T>where
L: RefUnwindSafe,
T: RefUnwindSafe,
impl<L, T> Send for PrefixedVec<L, T>
impl<L, T> Sync for PrefixedVec<L, T>
impl<L, T> Unpin for PrefixedVec<L, T>
impl<L, T> UnwindSafe for PrefixedVec<L, T>where
L: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more