Struct doomdooz_lib::types::Bytes

source ·
pub struct Bytes {
    pub raw: Vec<u8, Global>,
}
Expand description

Representation of a byte sequence

Fields§

§raw: Vec<u8, Global>

Raw vector of bytes

Implementations§

Constructs Bytes based on a given vector

Returns a reference to inner data

“Unwraps” self and returns inner data

Replaces inner data with given Vec

Appends a byte

Constructs an empty instance of Bytes

Converts byte sequence to a string slice, returns error if there are invalid UTF-8 chars

Converts byte sequnce to a string, all invalid UTF-8 chars are converted into “replacement char”

Converts byte sequence to a String, returns error if there are invalid UTF-8 chars

Consumes itself and convrters it into a string, returns error if there are invalid UTF-8 chars

Returns true if self represents a valid UTF-8 string

Returns true if byte sequence is empty

Returns length of the byte sequence

Clears inner data

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.