pub struct BorrowedCStream<'a> { /* private fields */ }Expand description
A borrowed RawCStream.
This has a lifetime parameter to tie it to the lifetime of something that owns the stream. For the duration of that lifetime, it is guaranteed that nobody will close the stream.
This uses #[repr(transparent)] and has the representation of a host stream,
so it can be used in FFI in places where a file descriptor is passed as an argument,
it is not captured or consumed, and it never has the value NULL.
This type’s Clone implementation returns another BorrowedCStream rather than an OwnedCStream.
It just makes a trivial copy of the raw file descriptor,
which is then borrowed under the same lifetime.
Implementations§
Source§impl<'a> BorrowedCStream<'a>
impl<'a> BorrowedCStream<'a>
Sourcepub const unsafe fn borrow_raw(raw: RawCStream) -> Self
pub const unsafe fn borrow_raw(raw: RawCStream) -> Self
Return a BorrowedCStream holding the given stream.
§Safety
The resource pointed to by raw must remain open for the duration of the returned BorrowedCStream.
Trait Implementations§
Source§impl AsCStream for BorrowedCStream<'_>
impl AsCStream for BorrowedCStream<'_>
Source§fn as_c_stream(&self) -> BorrowedCStream<'_>
fn as_c_stream(&self) -> BorrowedCStream<'_>
Source§impl AsRawCStream for BorrowedCStream<'_>
impl AsRawCStream for BorrowedCStream<'_>
Source§fn as_raw_c_stream(&self) -> RawCStream
fn as_raw_c_stream(&self) -> RawCStream
Source§impl<'a> Clone for BorrowedCStream<'a>
impl<'a> Clone for BorrowedCStream<'a>
Source§fn clone(&self) -> BorrowedCStream<'a>
fn clone(&self) -> BorrowedCStream<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more