pub struct RawVec<T>(pub Vec<T>);Expand description
This struct represents the concrete type of a vector, that is,
vector as opposed to the type Vector. This bare type is less
common, so instead of creating a enum for Vector wrapping vector
as Rust’s Vec (as we would do with auto-generated code),
a new-type for vector is used instead.
Tuple Fields§
§0: Vec<T>Trait Implementations§
Source§impl<T: Deserializable> Deserializable for RawVec<T>
impl<T: Deserializable> Deserializable for RawVec<T>
Source§fn deserialize(buf: Buffer<'_, '_>) -> Result<Self>
fn deserialize(buf: Buffer<'_, '_>) -> Result<Self>
Deserializes a vector of deserializable items according to the following definition:
vector#1cb5c415 {t:Type} # [ t ] = Vector t;.
§Examples
use gramme_types::{RawVec, Deserializable};
assert_eq!(RawVec::<i32>::from_bytes(&[0x0, 0x0, 0x0, 0x0]).unwrap().0, Vec::<i32>::new());
assert_eq!(RawVec::<i32>::from_bytes(&[0x1, 0x0, 0x0, 0x0, 0x7f, 0x0, 0x0, 0x0]).unwrap().0, vec![0x7f_i32]);Source§impl<T: Serializable> Serializable for RawVec<T>
impl<T: Serializable> Serializable for RawVec<T>
Source§fn serialize(&self, buf: Buffer<'_>)
fn serialize(&self, buf: Buffer<'_>)
Serializes a raw vector of serializable items according to the following definition:
vector#1cb5c415 {t:Type} # [ t ] = Vector t;.
§Examples
use gramme_types::{RawVec, Serializable};
assert_eq!(RawVec(Vec::<i32>::new()).to_bytes(), [0x0, 0x0, 0x0, 0x0]);
assert_eq!(RawVec(vec![0x7f_i32]).to_bytes(), [0x1, 0x0, 0x0, 0x0, 0x7f, 0x0, 0x0, 0x0]);impl<T> StructuralPartialEq for RawVec<T>
Auto Trait Implementations§
impl<T> Freeze for RawVec<T>
impl<T> RefUnwindSafe for RawVec<T>where
T: RefUnwindSafe,
impl<T> Send for RawVec<T>where
T: Send,
impl<T> Sync for RawVec<T>where
T: Sync,
impl<T> Unpin for RawVec<T>where
T: Unpin,
impl<T> UnwindSafe for RawVec<T>where
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