Skip to main content

Borrowed

Struct Borrowed 

Source
pub struct Borrowed<'a, T>(pub &'a mut T)
where
    T: ?Sized;
Expand description

Reborrow a Hadris I/O value without requiring a blanket implementation for &mut T.

Tuple Fields§

§0: &'a mut T

Implementations§

Source§

impl<'a, T> Borrowed<'a, T>
where T: ?Sized,

Source

pub fn new(inner: &'a mut T) -> Borrowed<'a, T>

Borrow an I/O value.

Trait Implementations§

Source§

impl<'a, T> Debug for Borrowed<'a, T>
where T: Debug + ?Sized,

Source§

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

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

impl<T> Read for Borrowed<'_, T>
where T: Read + ?Sized,

Source§

type Error = <T as Read>::Error

Error returned by the underlying source.
Source§

fn read( &mut self, buf: &mut [u8], ) -> Result<usize, Error<<Borrowed<'_, T> as Read>::Error>>

Read some bytes, returning zero at end of input.
Source§

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

Fill buf, retrying interrupted operations.
Source§

impl<T> Seek for Borrowed<'_, T>
where T: Seek + ?Sized,

Source§

type Error = <T as Seek>::Error

Error returned by the underlying stream.
Source§

fn seek( &mut self, pos: SeekFrom, ) -> Result<u64, Error<<Borrowed<'_, T> as Seek>::Error>>

Seek to a new byte position.
Source§

fn stream_position(&mut self) -> Result<u64, Error<Self::Error>>

Return the current byte position.
Source§

fn seek_relative(&mut self, offset: i64) -> Result<(), Error<Self::Error>>

Seek relative to the current byte position.
Source§

impl<T> Write for Borrowed<'_, T>
where T: Write + ?Sized,

Source§

type Error = <T as Write>::Error

Error returned by the underlying destination.
Source§

fn write( &mut self, buf: &[u8], ) -> Result<usize, Error<<Borrowed<'_, T> as Write>::Error>>

Write some bytes.
Source§

fn flush(&mut self) -> Result<(), Error<<Borrowed<'_, T> as Write>::Error>>

Flush buffered output.
Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Write all bytes, retrying interrupted operations.

Auto Trait Implementations§

§

impl<'a, T> !UnwindSafe for Borrowed<'a, T>

§

impl<'a, T> Freeze for Borrowed<'a, T>
where T: ?Sized,

§

impl<'a, T> RefUnwindSafe for Borrowed<'a, T>
where T: RefUnwindSafe + ?Sized,

§

impl<'a, T> Send for Borrowed<'a, T>
where T: Send + ?Sized,

§

impl<'a, T> Sync for Borrowed<'a, T>
where T: Sync + ?Sized,

§

impl<'a, T> Unpin for Borrowed<'a, T>
where T: ?Sized,

§

impl<'a, T> UnsafeUnpin for Borrowed<'a, T>
where T: ?Sized,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ReadExt for T
where T: Read + ?Sized,

Source§

fn read_struct<T>(&mut self) -> Result<T, Error>

Read an arbitrary-bit-pattern value.
Source§

fn parse<T>(&mut self) -> Result<T, Error>
where T: Parsable, Self: Sized,

Parse a value with its custom parser.
Source§

impl<T> ReadSeek for T
where T: Read + Seek<Error = <T as Read>::Error> + ?Sized,

Source§

impl<T> ReadWrite for T
where T: Read + Write<Error = <T as Read>::Error> + ?Sized,

Source§

impl<T> ReadWriteSeek for T
where T: Write<Error = <T as Read>::Error> + Seek<Error = <T as Read>::Error> + Read + ?Sized,

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