Struct Text
pub struct Text { /* private fields */ }
A byte array with each byte being a char. This is not UTF and it must be constructed from a standard string.
Implementations
impl Text
fn new_or_none(string: impl AsRef<str>) -> Option<Self>Create a
Textfrom anstrreference. ReturnsNoneif this string contains unsupported chars.fn new_or_panic(string: impl AsRef<str>) -> SelfCreate a
Textfrom anstrreference. Panics if this string contains unsupported chars.fn from_slice_unchecked(text: &TextSlice) -> SelfCreate a
Textfrom a slice of bytes, without checking any of the bytes.const fn from_bytes_unchecked(bytes: TextBytes) -> SelfCreate a
Textfrom the specified bytes object, without checking any of the bytes.fn as_slice(&self) -> &TextSliceThe internal ASCII bytes this text is made of.
fn validate(&self, null_terminated: bool, long_names: Option<&mut bool>) -> UnitResultCheck whether this string is valid, adjusting
long_namesif required. Iflong_namesis not provided, text length will be entirely unchecked.fn validate_bytes(text: &TextSlice, null_terminated: bool, long_names: Option<&mut bool>) -> UnitResultCheck whether some bytes are valid, adjusting
long_namesif required. Iflong_namesis not provided, text length will be entirely unchecked.fn null_terminated_byte_size(&self) -> usizeThe byte count this string would occupy if it were encoded as a null-terminated string.
fn i32_sized_byte_size(&self) -> usizeThe byte count this string would occupy if it were encoded as a size-prefixed string.
fn u32_sized_byte_size(&self) -> usizeThe byte count this string would occupy if it were encoded as a size-prefixed string.
fn write_i32_sized_le<W: Write>(&self, write: &mut W) -> UnitResultWrite the length of a string and then the contents with that length.
fn write_u32_sized_le<W: Write>(&self, write: &mut W) -> UnitResultWrite the length of a string and then the contents with that length.
fn read_i32_sized_le<R: Read>(read: &mut R, max_size: usize) -> Result<Self>Read the length of a string and then the contents with that length.
fn read_u32_sized_le<R: Read>(read: &mut R, max_size: usize) -> Result<Self>Read the length of a string and then the contents with that length.
fn read_sized<R: Read>(read: &mut R, size: usize) -> Result<Self>Read the contents with that length.
fn write_null_terminated<W: Write>(&self, write: &mut W) -> UnitResultWrite the string contents and a null-terminator.
fn read_null_terminated<R: Read>(read: &mut R, max_len: usize) -> Result<Self>Read a string until the null-terminator is found. Then skips the null-terminator.
fn bytes(&self) -> &[u8]The underlying bytes that represent this text.
fn chars(&self) -> impl '_ + Iterator<Item = char>Iterate over the individual chars in this text, similar to
String::chars(). Does not do any heap-allocation but borrows from this instance instead.fn eq(&self, string: &str) -> boolCompare this
exr::Textwith a plain&str.fn eq_case_insensitive(&self, string: &str) -> boolCompare this
exr::Textwith a plain&strignoring capitalization.
Trait Implementations
impl Borrow<[u8]> for Text
fn borrow(&self) -> &TextSlice
impl Clone for Text
fn clone(&self) -> Self
impl Debug for Text
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Text
fn default() -> Self
impl Display for Text
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Text
impl Hash for Text
fn hash<H: Hasher>(&self, state: &mut H)
impl Ord for Text
fn cmp(&self, other: &Self) -> Ordering
impl PartialEq for Text
fn eq(&self, other: &Self) -> bool
impl PartialEq<str> for Text
fn eq(&self, other: &str) -> bool
impl PartialOrd for Text
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
impl StructuralPartialEq for Text
impl<'s> From<&'s str> for Text
fn from(str: &'s str) -> SelfPanics if the string contains an unsupported character