[][src]Struct grammers_tl_types::RawVec

pub struct RawVec<T>(pub Vec<T>);

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]);

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]);

impl<T> StructuralPartialEq for RawVec<T>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.