UniquePtr in cxx - Rust

pub struct UniquePtr<T>

where T: UniquePtrTarget,

{ /* private fields */ }
Expand description

Binding to C++ std::unique_ptr<T, std::default_delete<T>>.

Source§
Source

Makes a new UniquePtr wrapping a null pointer.

Matches the behavior of default-constructing a std::unique_ptr.

Source

Allocates memory on the heap and makes a UniquePtr pointing to it.

Source
Source

Returns a reference to the object owned by this UniquePtr if any, otherwise None.

Source

Returns a mutable pinned reference to the object owned by this UniquePtr if any, otherwise None.

Source

Returns a mutable pinned reference to the object owned by this UniquePtr.

§Panics

Panics if the UniquePtr holds a null pointer.

Source

Returns a raw const pointer to the object owned by this UniquePtr if any, otherwise the null pointer.

Source

Returns a raw mutable pointer to the object owned by this UniquePtr if any, otherwise the null pointer.

As with std::unique_ptr<T>::get, this doesn’t require that you hold an exclusive reference to the UniquePtr. This differs from Rust norms, so extra care should be taken in the way the pointer is used.

Source
Source

Constructs a UniquePtr retaking ownership of a pointer previously obtained from into_raw.

§Safety

This function is unsafe because improper use may lead to memory problems. For example a double-free may occur if the function is called twice on the same raw pointer.

Source§
Source§
Source§

The resulting type after dereferencing.

Source§

Dereferences the value.

Source§
Source§

Mutably dereferences the value.

Source§
Source§
Source§
Source§

Converts to this type from the input type.

Source§
Source§
Source§
Source§

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

1.0.0 · Source§

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

Source§
Source§

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

1.0.0 · Source§

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

1.0.0 · Source§

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

1.0.0 · Source§

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

1.0.0 · Source§

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

Source§

Available on crate feature std only.

Forwarding Read trait implementation in a manner similar to Box<T>.

Note that the implementation will panic for null UniquePtr<T>.

Source§

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

Source§

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

Source§

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

Source§

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

1.36.0 · Source§

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

Source§

🔬This is a nightly-only experimental API. (can_vector)

Determines if this Reader has an efficient read_vectored implementation. Read more

Source§

🔬This is a nightly-only experimental API. (read_buf)

Pull some bytes from this source into the specified buffer. Read more

Source§

🔬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§

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

1.0.0 · Source§

Transforms this Read instance to an Iterator over its bytes. Read more

1.0.0 · Source§

Creates an adapter which will chain this stream with another. Read more

1.0.0 · Source§

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

Source§

🔬This is a nightly-only experimental API. (read_array)

Read and return a fixed array of bytes from this source. Read more

Source§

Available on crate feature std only.

Forwarding Seek trait implementation in a manner similar to Box<T>.

Note that the implementation will panic for null UniquePtr<T>.

Source§

Available on crate feature std only.

Forwarding Write trait implementation in a manner similar to Box<T>.

Note that the implementation will panic for null UniquePtr<T>.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

🔬This is a nightly-only experimental API. (can_vector)

Source§

🔬This is a nightly-only experimental API. (write_all_vectored)

Attempts to write multiple buffers into this writer. Read more

1.0.0 · Source§

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

Source§
Source§
Source§
Source§