CFRetained

Struct CFRetained 

Source
pub struct CFRetained<T: ?Sized> { /* private fields */ }
Expand description

A reference counted pointer type for CoreFoundation types.

CFRetained strongly references or “retains” the given object T, and decrements the retain count or “releases” it again when dropped, thereby ensuring it will be deallocated at the right time.

The type T inside CFRetained<T> can be anything that implements Type, i.e. any CoreFoundation-like type.

§Comparison to other types

CFRetained<T> is equivalent to objc2::rc::Retained, and can be converted to/from that when the "objc2" feature is enabled. Note though that this uses the underlying CoreFoundation primitives CFRetain / CFRelease / CFAutorelease instead of objc_retain / objc_release / objc_autorelease, to avoid depending on the Objective-C runtime if not needed.

You can also view CFRetained<T> as the CoreFoundation equivalent of std::sync::Arc, that is, it is a thread-safe reference-counting smart pointer that allows cloning by bumping the reference count.

Unlike Arc, objects can be retained directly from a &T using Type::retain (for Arc you need &Arc<T>).

Weak references are not supported though without the Objective-C runtime.

§Forwarding implementations

Since CFRetained<T> is a smart pointer, it Derefs to T.

It also forwards the implementation of a bunch of standard library traits such as PartialEq, AsRef, and so on, so that it becomes possible to use e.g. CFRetained<CFString> as-if it was CFString. Note that having a CFString directly is not possible since CoreFoundation objects cannot live on the stack, but instead must reside on the heap, and as such must be accessed behind a pointer or a reference (i.e. &CFString).

§Memory layout

This is guaranteed to have the same size and alignment as a pointer to the object, *const T.

Additionally, it participates in the null-pointer optimization, that is, Option<CFRetained<T>> is guaranteed to have the same size as CFRetained<T>.

Implementations§

Source§

impl<T: ?Sized + Type> CFRetained<T>

Source

pub unsafe fn from_raw(ptr: NonNull<T>) -> Self

Construct a CFRetained from a pointer that already has +1 retain count.

This is useful when you have been given a pointer to a type from some API that returns a retained pointer (i.e. follows the Create rule).

§Safety

You must uphold the same requirements as described in CFRetained::retain.

Additionally, you must ensure the given object pointer has +1 retain count.

Source

pub fn into_raw(this: Self) -> NonNull<T>

Consumes the CFRetained, returning a raw pointer with +1 retain count.

After calling this function, the caller is responsible for the memory previously managed by the CFRetained.

This is effectively the opposite of CFRetained::from_raw, see that for more details on when this function is useful.

This is an associated method, and must be called as CFRetained::into_raw(obj).

Source

pub fn as_ptr(this: &Self) -> NonNull<T>

Returns a raw pointer to the type.

The pointer is valid for at least as long as the CFRetained is held.

This is an associated method, and must be called as CFRetained::as_ptr(&obj).

Source

pub unsafe fn cast_unchecked<U: Type>(this: Self) -> CFRetained<U>

Unchecked conversion to another CoreFoundation type.

This is equivalent to an unsafe cast between two pointers, see CFRetained::downcast for a safe alternative.

This is an associated method, and must be called as CFRetained::cast_unchecked(obj).

§Safety

You must ensure that the type can be reinterpreted as the given type.

If T is not 'static, you must ensure that U ensures that the data contained by T is kept alive for as long as U lives.

Additionally, you must ensure that any safety invariants that the new type has are upheld.

Source§

impl<T: Type> CFRetained<T>

Source

pub fn downcast<U: ConcreteType>(self) -> Result<CFRetained<U>, Self>
where T: 'static,

Attempt to downcast the type to that of type U.

This is the owned variant. Use CFType::downcast_ref if you want to convert a reference type. See also ConcreteType for more details on which types support being converted to.

See CFType::downcast_ref for more details.

§Errors

If casting failed, this will return the original back as the Err variant. If you do not care about this, and just want an Option, use .downcast().ok().

Source

pub unsafe fn retain(ptr: NonNull<T>) -> Self

Retain the pointer and construct a CFRetained from it.

This is useful when you have been given a pointer to a type from some API that returns a non-retained reference (i.e. follows the Get rule).

See also Type::retain for a safe alternative when you already have a reference to the type.

§Safety

The pointer must be valid as a reference (aligned, dereferenceable and initialized, see the std::ptr module for more information).

You must ensure that if T is non-'static (i.e. has a lifetime parameter), that any data that T may reference lives for at least as long as the return value.

Source

pub fn autorelease_ptr(this: Self) -> *mut T

Autoreleases the CFRetained, returning a pointer.

The object is not immediately released, but will be when the innermost / current autorelease pool is drained.

This is an associated method, and must be called as CFRetained::autorelease_ptr(obj).

§Safety

This method is safe to call, but the returned pointer is only guaranteed to be valid until the innermost autorelease pool is drained.

Trait Implementations§

Source§

impl<T: ?Sized + AsRef<U>, U: ?Sized> AsRef<U> for CFRetained<T>

Source§

fn as_ref(&self) -> &U

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Binary + ?Sized> Binary for Retained<T>

Source§

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

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

impl<T: ?Sized> Borrow<T> for CFRetained<T>

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T: Type> Clone for CFRetained<T>

Source§

fn clone(&self) -> Self

Retain the type, increasing its reference count.

This calls Type::retain internally.

1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + ?Sized> Debug for Retained<T>

Source§

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

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

impl<T: ?Sized> Deref for CFRetained<T>

Source§

fn deref(&self) -> &T

Obtain a reference to the type.

Source§

type Target = T

The resulting type after dereferencing.
Source§

impl<T: Display + ?Sized> Display for Retained<T>

Source§

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

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

impl<T: ?Sized> Drop for CFRetained<T>

Source§

fn drop(&mut self)

Releases the contained type.

Source§

impl<T: ?Sized + Error> Error for CFRetained<T>

Available on crate feature std only.
Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl<'a, A, T: ?Sized> Extend<A> for &'a CFRetained<T>
where &'a T: Extend<A>,

Source§

fn extend<I: IntoIterator<Item = A>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<A, T: ?Sized> Extend<A> for CFRetained<T>
where for<'a> &'a T: Extend<A>,

Source§

fn extend<I: IntoIterator<Item = A>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T: ?Sized + AsRef<U>, U: Type> From<&T> for CFRetained<U>

Source§

fn from(obj: &T) -> Self

Cast the type to a superclass or CFType, and retain it.

Source§

impl<T: ?Sized + ConcreteType + 'static> From<CFRetained<T>> for CFRetained<CFType>

Source§

fn from(obj: CFRetained<T>) -> Self

Convert to CFType.

Source§

impl<T: ?Sized + Message> From<CFRetained<T>> for Retained<T>

Available on crate feature objc2 only.
Source§

fn from(obj: CFRetained<T>) -> Self

Convert a CFRetained into a objc2::rc::Retained.

This conversion is cost-free, since CoreFoundation types are fully interoperable with Objective-C retain/release message sending.

Source§

impl<T: ?Sized + Type + Message> From<Retained<T>> for CFRetained<T>

Available on crate feature objc2 only.
Source§

fn from(obj: Retained<T>) -> Self

Convert a objc2::rc::Retained into a CFRetained.

This only works if the type is a CoreFoundation type (implements the Type trait).

This conversion is cost-free.

Source§

impl<'a, T: ?Sized> Future for &'a CFRetained<T>
where &'a T: Future,

Source§

type Output = <&'a T as Future>::Output

The type of value produced on completion.
Source§

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>

Attempts to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
Source§

impl<T: Hash + ?Sized> Hash for CFRetained<T>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, T: ?Sized> Hasher for &'a CFRetained<T>
where &'a T: Hasher,

Source§

fn finish(&self) -> u64

Returns the hash value for the values written so far. Read more
Source§

fn write(&mut self, bytes: &[u8])

Writes some data into this Hasher. Read more
Source§

fn write_u8(&mut self, i: u8)

Writes a single u8 into this hasher.
Source§

fn write_u16(&mut self, i: u16)

Writes a single u16 into this hasher.
Source§

fn write_u32(&mut self, i: u32)

Writes a single u32 into this hasher.
Source§

fn write_u64(&mut self, i: u64)

Writes a single u64 into this hasher.
Source§

fn write_u128(&mut self, i: u128)

Writes a single u128 into this hasher.
Source§

fn write_usize(&mut self, i: usize)

Writes a single usize into this hasher.
Source§

fn write_i8(&mut self, i: i8)

Writes a single i8 into this hasher.
Source§

fn write_i16(&mut self, i: i16)

Writes a single i16 into this hasher.
Source§

fn write_i32(&mut self, i: i32)

Writes a single i32 into this hasher.
Source§

fn write_i64(&mut self, i: i64)

Writes a single i64 into this hasher.
Source§

fn write_i128(&mut self, i: i128)

Writes a single i128 into this hasher.
Source§

fn write_isize(&mut self, i: isize)

Writes a single isize into this hasher.
Source§

fn write_length_prefix(&mut self, len: usize)

🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a length prefix into this hasher, as part of being prefix-free. Read more
Source§

fn write_str(&mut self, s: &str)

🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a single str into this hasher. Read more
Source§

impl<T: ?Sized> Hasher for CFRetained<T>
where for<'a> &'a T: Hasher,

Source§

fn finish(&self) -> u64

Returns the hash value for the values written so far. Read more
Source§

fn write(&mut self, bytes: &[u8])

Writes some data into this Hasher. Read more
Source§

fn write_u8(&mut self, i: u8)

Writes a single u8 into this hasher.
Source§

fn write_u16(&mut self, i: u16)

Writes a single u16 into this hasher.
Source§

fn write_u32(&mut self, i: u32)

Writes a single u32 into this hasher.
Source§

fn write_u64(&mut self, i: u64)

Writes a single u64 into this hasher.
Source§

fn write_u128(&mut self, i: u128)

Writes a single u128 into this hasher.
Source§

fn write_usize(&mut self, i: usize)

Writes a single usize into this hasher.
Source§

fn write_i8(&mut self, i: i8)

Writes a single i8 into this hasher.
Source§

fn write_i16(&mut self, i: i16)

Writes a single i16 into this hasher.
Source§

fn write_i32(&mut self, i: i32)

Writes a single i32 into this hasher.
Source§

fn write_i64(&mut self, i: i64)

Writes a single i64 into this hasher.
Source§

fn write_i128(&mut self, i: i128)

Writes a single i128 into this hasher.
Source§

fn write_isize(&mut self, i: isize)

Writes a single isize into this hasher.
Source§

fn write_length_prefix(&mut self, len: usize)

🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a length prefix into this hasher, as part of being prefix-free. Read more
Source§

fn write_str(&mut self, s: &str)

🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a single str into this hasher. Read more
Source§

impl<T: Type> IntoIterator for CFRetained<CFArray<T>>

Available on crate feature CFArray only.
Source§

type Item = CFRetained<T>

The type of the elements being iterated over.
Source§

type IntoIter = CFArrayIntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: Type> IntoIterator for CFRetained<CFMutableArray<T>>

Available on crate feature CFArray only.
Source§

type Item = CFRetained<T>

The type of the elements being iterated over.
Source§

type IntoIter = CFArrayIntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: LowerExp + ?Sized> LowerExp for Retained<T>

Source§

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

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

impl<T: LowerHex + ?Sized> LowerHex for Retained<T>

Source§

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

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

impl<T: Octal + ?Sized> Octal for Retained<T>

Source§

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

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

impl<T: Ord + ?Sized> Ord for CFRetained<T>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: ?Sized + PartialEq<U>, U: ?Sized> PartialEq<CFRetained<U>> for CFRetained<T>

Source§

fn eq(&self, other: &Retained<U>) -> bool

Tests for self and other values to be equal, and is used by ==.
Source§

fn ne(&self, other: &Retained<U>) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: ?Sized + PartialOrd<U>, U: ?Sized> PartialOrd<CFRetained<U>> for CFRetained<T>

Source§

fn partial_cmp(&self, other: &Retained<U>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, other: &Retained<U>) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &Retained<U>) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

fn ge(&self, other: &Retained<U>) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

fn gt(&self, other: &Retained<U>) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

impl<T: ?Sized> Pointer for CFRetained<T>

Source§

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

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

impl<'a, T: ?Sized> Read for &'a CFRetained<T>
where &'a T: Read,

Available on crate feature std only.
Source§

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

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>

Like read, except that it reads into a slice of buffers. Read more
Source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>

Reads all bytes until EOF in this source, placing them into buf. Read more
Source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize>

Reads all bytes until EOF in this source, appending them to buf. Read more
Source§

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

Reads the exact number of bytes required to fill buf. Read more
Source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored implementation. Read more
Source§

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adaptor for this instance of Read. Read more
1.0.0 · Source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where R: Read, Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

impl<T: ?Sized> Read for CFRetained<T>
where for<'a> &'a T: Read,

Available on crate feature std only.
Source§

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

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>

Like read, except that it reads into a slice of buffers. Read more
Source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>

Reads all bytes until EOF in this source, placing them into buf. Read more
Source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize>

Reads all bytes until EOF in this source, appending them to buf. Read more
Source§

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

Reads the exact number of bytes required to fill buf. Read more
Source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored implementation. Read more
Source§

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adaptor for this instance of Read. Read more
1.0.0 · Source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where R: Read, Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

impl<'a, T: ?Sized> Seek for &'a CFRetained<T>
where &'a T: Seek,

Available on crate feature std only.
Source§

fn seek(&mut self, pos: SeekFrom) -> Result<u64>

Seek to an offset, in bytes, in a stream. Read more
Source§

fn stream_position(&mut self) -> Result<u64>

Returns the current seek position from the start of the stream. Read more
1.55.0 · Source§

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

Rewind to the beginning of a stream. Read more
Source§

fn stream_len(&mut self) -> Result<u64, Error>

🔬This is a nightly-only experimental API. (seek_stream_len)
Returns the length of this stream (in bytes). Read more
1.80.0 · Source§

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

Seeks relative to the current position. Read more
Source§

impl<T: ?Sized> Seek for CFRetained<T>
where for<'a> &'a T: Seek,

Available on crate feature std only.
Source§

fn seek(&mut self, pos: SeekFrom) -> Result<u64>

Seek to an offset, in bytes, in a stream. Read more
Source§

fn stream_position(&mut self) -> Result<u64>

Returns the current seek position from the start of the stream. Read more
1.55.0 · Source§

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

Rewind to the beginning of a stream. Read more
Source§

fn stream_len(&mut self) -> Result<u64, Error>

🔬This is a nightly-only experimental API. (seek_stream_len)
Returns the length of this stream (in bytes). Read more
1.80.0 · Source§

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

Seeks relative to the current position. Read more
Source§

impl<T: UpperExp + ?Sized> UpperExp for Retained<T>

Source§

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

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

impl<T: UpperHex + ?Sized> UpperHex for Retained<T>

Source§

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

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

impl<'a, T: ?Sized> Write for &'a CFRetained<T>
where &'a T: Write,

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
Source§

fn write_char(&mut self, c: char) -> Result

Writes a char into this writer, returning whether the write succeeded. Read more
Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<'a, T: ?Sized> Write for &'a CFRetained<T>
where &'a T: Write,

Available on crate feature std only.
Source§

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

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn flush(&mut self) -> Result<()>

Flushes this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
Source§

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

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()>

Writes a formatted string into this writer, returning any error encountered. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more
Source§

impl<T: ?Sized> Write for CFRetained<T>
where for<'a> &'a T: Write,

Available on crate feature std only.
Source§

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

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn flush(&mut self) -> Result<()>

Flushes this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
Source§

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

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()>

Writes a formatted string into this writer, returning any error encountered. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more
Source§

impl<T: Eq + ?Sized> Eq for CFRetained<T>

Source§

impl<T: ?Sized + RefUnwindSafe> RefUnwindSafe for CFRetained<T>

Source§

impl<T: ?Sized + Sync + Send> Send for CFRetained<T>

CFRetained<T> is Send if T is Send + Sync.

Source§

impl<T: ?Sized + Sync + Send> Sync for CFRetained<T>

CFRetained<T> is Sync if T is Send + Sync.

Source§

impl<T: ?Sized> Unpin for CFRetained<T>

Source§

impl<T: ?Sized + RefUnwindSafe> UnwindSafe for CFRetained<T>

Auto Trait Implementations§

§

impl<T> Freeze for CFRetained<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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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> AutoreleaseSafe for T
where T: ?Sized,