pub struct Written { /* private fields */ }
Expand description

Represents the return value of crate::to_writer function.

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

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

Implementations§

source§

impl Written

source

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

Create a new Written instance.

source

pub fn set_fds(self, fds: impl IntoIterator<Item = impl Into<OwnedFd>>) -> Self

Set the 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 into_fds(self) -> Vec<OwnedFd>

Consume self and return the file descriptors.

This method is only available on Unix platforms.

source

pub fn fds(&self) -> &[OwnedFd]

The 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 = 4_294_967_295usize

1.53.0 · source

pub const BITS: u32 = 32u32

Trait Implementations§

source§

impl Debug for Written

source§

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

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

impl Deref for Written

§

type Target = usize

The resulting type after dereferencing.
source§

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

Dereferences the value.

Auto Trait Implementations§

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>,

§

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>,

§

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.