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
sourceimpl<T: Deserializable> Deserializable for RawVec<T>
impl<T: Deserializable> Deserializable for RawVec<T>
sourcefn 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]);
sourceimpl<T: Serializable> Serializable for RawVec<T>
impl<T: Serializable> Serializable for RawVec<T>
sourcefn 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> 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more