doc.rust-lang.org
pub unsafe fn from_vec_with_nul_unchecked(v: Vec<u8>) -> Self
Converts a Vec<u8> to a CString without checking the invariants on the given Vec.
associated_function
alloc
Stable since 1.58.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn from_vec_with_nul(v: Vec<u8>) -> Result<Self, FromVecWithNulError>
Attempts to convert a Vec<u8> to a CString.
associated_function
alloc
Stable since 1.58.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn from_vec_unchecked(v: Vec<u8>) -> Self
Creates a C-compatible string by consuming a byte vector, without checking for interior 0 bytes.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn from_raw(ptr: *mut c_char) -> CString
Retakes ownership of a CString that was transferred to C via CString::into_raw.
associated_function
alloc
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_c_str(&self) -> &CStr
Extracts a CStr slice containing the entire string.
method
alloc
Stable since 1.20.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_bytes_with_nul(&self) -> &[u8]
Equivalent to CString::as_bytes() except that the returned slice includes the trailing nul terminator.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_bytes(&self) -> &[u8]
Returns the contents of this CString as a slice of bytes.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct CString
A type representing an owned, C-compatible, nul-terminated string with no nul bytes in the middle.
struct
alloc
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod c_str
CString and its related types.
module
alloc
Stable since 1.88.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod ffi
Utilities related to FFI bindings.
module
alloc
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct IterMut<'a, T>
A mutable iterator over the elements of a VecDeque.
struct
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Iter<'a, T>
An iterator over the elements of a VecDeque.
struct
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct IntoIter<T, A>
An owning iterator over the elements of a VecDeque.
struct
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Drain<'a, T, A>
A draining iterator over the elements of a VecDeque.
struct
alloc
Stable since 1.6.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn with_capacity(capacity: usize) -> VecDeque<T>
Creates an empty deque with space for at least capacity elements.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError>
Tries to reserve the minimum capacity for at least additional more elements to be inserted in the given deque. After calling try_reserve_exact, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if the capacity is already sufficient.
method
alloc
Stable since 1.57.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
Tries to reserve capacity for at least additional more elements to be inserted in the given deque. The collection may reserve more space to speculatively avoid frequent reallocations. After calling try_reserve, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if capacity is already sufficient. This method preserves the contents even if an error occurs.
method
alloc
Stable since 1.57.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn truncate(&mut self, len: usize)
Shortens the deque, keeping the first len elements and dropping the rest.
method
alloc
Stable since 1.16.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn swap_remove_front(&mut self, index: usize) -> Option<T>
Removes an element from anywhere in the deque and returns it, replacing it with the first element.
method
alloc
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn swap_remove_back(&mut self, index: usize) -> Option<T>
Removes an element from anywhere in the deque and returns it, replacing it with the last element.
method
alloc
Stable since 1.5.0
Version 1.100.0-nightly