Struct cxx_qt_lib::QByteArray
source · #[repr(C)]pub struct QByteArray { /* private fields */ }
Expand description
The QByteArray class provides an array of bytes.
Implementations§
source§impl QByteArray
impl QByteArray
source§impl QByteArray
impl QByteArray
source§impl QByteArray
impl QByteArray
source§impl QByteArray
impl QByteArray
source§impl QByteArray
impl QByteArray
source§impl QByteArray
impl QByteArray
source§impl QByteArray
impl QByteArray
sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Construct a mutable slice of u8 from a QByteArray
sourcepub fn fill(&mut self, ch: u8, size: isize)
pub fn fill(&mut self, ch: u8, size: isize)
Sets every byte in the byte array to ch. If size is different from -1 (the default), the byte array is resized to size size beforehand.
sourcepub unsafe fn from_raw_data(bytes: &[u8]) -> Self
pub unsafe fn from_raw_data(bytes: &[u8]) -> Self
Construct a QByteArray from a &[u8]
without a deep copy
§Safety
The caller must ensure that the original slice outlives the QByteArray and that the QByteArray is not modified
sourcepub fn insert(&mut self, pos: isize, ch: u8)
pub fn insert(&mut self, pos: isize, ch: u8)
Inserts item value into the list at the given position.
sourcepub fn remove(&mut self, pos: isize, len: isize)
pub fn remove(&mut self, pos: isize, len: isize)
Removes len bytes from the array, starting at index position pos.
sourcepub fn reserve(&mut self, size: isize)
pub fn reserve(&mut self, size: isize)
Reserve the specified capacity to prevent repeated allocations when the maximum size is known.
sourcepub fn resize(&mut self, size: isize)
pub fn resize(&mut self, size: isize)
Sets the size of the byte array to size bytes.
If size is greater than the current size, the byte array is extended to make it size bytes with the extra bytes added to the end. The new bytes are uninitialized.
If size is less than the current size, bytes beyond position size are excluded from the byte array.
sourcepub fn simplified(&self) -> Self
pub fn simplified(&self) -> Self
Returns a copy of this byte array that has spacing characters removed from the start and end, and in which each sequence of internal spacing characters is replaced with a single space.
sourcepub fn to_lower(&self) -> Self
pub fn to_lower(&self) -> Self
Returns a copy of the byte array in which each ASCII uppercase letter converted to lowercase.
Trait Implementations§
source§impl AsRef<[u8]> for QByteArray
impl AsRef<[u8]> for QByteArray
source§impl Clone for QByteArray
impl Clone for QByteArray
source§fn clone(&self) -> Self
fn clone(&self) -> Self
Constructs a copy of other.
This operation takes constant time, because QByteArray is implicitly shared similar to a std::borrow::Cow. This makes returning a QByteArray from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes linear time.
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for QByteArray
impl Debug for QByteArray
source§impl Display for QByteArray
impl Display for QByteArray
source§impl ExternType for QByteArray
impl ExternType for QByteArray
source§impl From<&[u8]> for QByteArray
impl From<&[u8]> for QByteArray
source§impl From<&QByteArray> for Vec<u8>
impl From<&QByteArray> for Vec<u8>
source§fn from(bytearray: &QByteArray) -> Self
fn from(bytearray: &QByteArray) -> Self
Convert the QByteArray to a Vec<u8>
. This makes a deep copy of the data.