Skip to main content

IpcReadHandle

Enum IpcReadHandle 

Source
#[non_exhaustive]
pub enum IpcReadHandle { File(IpcFileHandle), Bytes(IpcBytes), }
Expand description

File handle or allocated bytes that can be read after sending to another process.

§Position

Read always starts from the beginning, the read methods seek the file start before returning. Note that the read position is associated with the system handle, if you create multiple duplicates of the same handle reading in one instance advances the position in all.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

File(IpcFileHandle)

Read directly from disk.

§

Bytes(IpcBytes)

Read from allocated bytes.

Implementations§

Source§

impl IpcReadHandle

Source

pub fn best_read_blocking(file: File) -> Result<Self>

Either keep the handle or read to bytes, whichever is likely to be faster for the common usage pattern of sending to another process and a single full read with some seeking.

Source

pub async fn best_read(file: File) -> Result<Self>

Either keep the handle or read to bytes, whichever is likely to be faster for the common usage pattern of sending to another process and a single full read with some seeking.

Source

pub fn duplicate(&self) -> Result<Self>

Duplicate file handle or clone reference to bytes.

Source

pub fn read_blocking(self) -> Result<IpcReadBlocking>

Begin reading using the std blocking API.

Source

pub async fn read(self) -> Result<IpcRead>

Begin reading using the async API.

Source

pub fn read_to_bytes_blocking(self) -> Result<IpcBytes>

Read file to new IpcBytes or unwrap bytes.

Source

pub async fn read_to_bytes(self) -> Result<IpcBytes>

Read file to new IpcBytes or unwrap bytes.

Source

pub async fn duplicate_or_read(&mut self) -> Result<Self>

Attempts duplicate with read fallback.

If duplicate fails attempts read_to_bytes, if it succeeds replaces self with read bytes and returns a clone if it fails replaces self with empty and returns the read error.

Source

pub fn duplicate_or_read_blocking(&mut self) -> Result<Self>

Attempts duplicate with read fallback.

If duplicate fails attempts read_to_bytes_blocking, if it succeeds replaces self with read bytes and returns a clone if it fails replaces self with empty and returns the read error.

Trait Implementations§

Source§

impl Debug for IpcReadHandle

Source§

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

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

impl<'de> Deserialize<'de> for IpcReadHandle

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<File> for IpcReadHandle

Source§

fn from(f: File) -> Self

Converts to this type from the input type.
Source§

impl From<IpcBytes> for IpcReadHandle

Source§

fn from(b: IpcBytes) -> Self

Converts to this type from the input type.
Source§

impl From<IpcFileHandle> for IpcReadHandle

Source§

fn from(f: IpcFileHandle) -> Self

Converts to this type from the input type.
Source§

impl Serialize for IpcReadHandle

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> IpcValue for T
where T: Serialize + for<'d> Deserialize<'d> + Send + 'static,

Source§

impl<T> StateValue for T
where T: Any + Send + Sync,