zvariant::serialized

Struct Size

Source
pub struct Size { /* private fields */ }
Expand description

Represents the return value of crate::serialized_size function.

It mainly contains the size of serialized bytes in a specific format.

On Unix platforms, it also contains the number of file descriptors, whose indexes are included in the serialized bytes.

Implementations§

Source§

impl Size

Source

pub fn new(size: usize, context: Context) -> Self

Create a new Size instance.

Source

pub fn set_num_fds(self, num_fds: u32) -> Self

Set the number of file descriptors.

Source

pub fn size(&self) -> usize

The size of the serialized bytes.

Source

pub fn context(&self) -> Context

The encoding context.

Source

pub fn num_fds(&self) -> u32

The number file descriptors that are references by the serialized bytes.

This method is only available on Unix platforms.

Methods from Deref<Target = usize>§

1.43.0 · Source

pub const MIN: usize = 0usize

1.43.0 · Source

pub const MAX: usize = 18_446_744_073_709_551_615usize

1.53.0 · Source

pub const BITS: u32 = 64u32

Trait Implementations§

Source§

impl Debug for Size

Source§

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

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

impl Deref for Size

Source§

type Target = usize

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl Freeze for Size

§

impl RefUnwindSafe for Size

§

impl Send for Size

§

impl Sync for Size

§

impl Unpin for Size

§

impl UnwindSafe for Size

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.