fuchsia_wayland_core

Struct Array

Source
pub struct Array(/* private fields */);
Expand description

Wrapper around the array data provided by the wayland wire format.

On the wire, wl_array arguments are simple byte arrays. Protocol documentation may specify a specific interpretation of the bytes, however this is not directly modeled in the protocol XML.

For example, the wl_keyboard::enter event has an argument for the set of keys pressed at the time of the event:

While not explitly stated, |keys| is an array of |uint| arguments. These are packed into the array using the same rules used to write consecutive |uint| arguments to a Message.

Implementations§

Source§

impl Array

Source

pub fn new() -> Self

Creates a new, empty Array.

Source

pub fn from_vec(v: Vec<u8>) -> Self

Creates a new Array that contains the bytes stored in the provided Vec.

Source

pub fn as_slice(&self) -> &[u8]

Access the array data as a slice.

Source

pub fn into_vec(self) -> Vec<u8>

Extracts the Array data as a Vec.

Source

pub fn len(&self) -> usize

Returns the length (in bytes) of the array.

Source

pub fn push<T: Into<Arg>>(&mut self, arg: T) -> Result<()>

Writes an Arg to the end of this Array, increasing its size.

Note that arrays cannot contain handles and it is an error to attempt to write an Arg::Handle to an array.

Source

pub fn read_arg(&mut self, kind: ArgKind) -> Result<Arg>

Reads an Arg out of this Array and return the value.

Note that arrays cannot contain handles and it is an error to attempt to read an ArgKind::Handle from an array.

Trait Implementations§

Source§

impl Debug for Array

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Array> for Arg

Source§

fn from(v: Array) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Array

Source§

fn from(v: Vec<u8>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Array

§

impl RefUnwindSafe for Array

§

impl Send for Array

§

impl Sync for Array

§

impl Unpin for Array

§

impl UnwindSafe for Array

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V