[−][src]Struct grammers_tl_types::RawVec
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.
Trait Implementations
impl<T: Clone> Clone for RawVec<T>
[src]
impl<T: Debug> Debug for RawVec<T>
[src]
impl<T: Deserializable> Deserializable for RawVec<T>
[src]
fn deserialize(buf: &'a mut Cursor<'b>) -> Result<Self, DeserializeError>
[src]
Deserializes a vector of deserializable items according to the following definition:
vector#1cb5c415 {t:Type} # [ t ] = Vector t;
.
Examples
use grammers_tl_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]);
fn from_bytes(buf: &[u8]) -> Result<Self, DeserializeError> where
Self: Sized,
[src]
Self: Sized,
impl<T: PartialEq> PartialEq<RawVec<T>> for RawVec<T>
[src]
impl<T: Serializable> Serializable for RawVec<T>
[src]
fn serialize(&self, buf: &'a mut Vec<u8>)
[src]
Serializes a raw vector of serializable items according to the following definition:
vector#1cb5c415 {t:Type} # [ t ] = Vector t;
.
Examples
use grammers_tl_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]);
fn to_bytes(&self) -> Vec<u8>
[src]
impl<T> StructuralPartialEq for RawVec<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for RawVec<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for RawVec<T> where
T: Send,
T: Send,
impl<T> Sync for RawVec<T> where
T: Sync,
T: Sync,
impl<T> Unpin for RawVec<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for RawVec<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,