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
Auto Trait Implementations
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnsafeUnpin for Text
impl UnwindSafe for Text
Blanket Implementations
impl<R, P> ReadPrimitive<R> for Text
where
R: Read + ReadEndian<P>,
P: Default,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for Text
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for Text
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for Text
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Text
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Text
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Text
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Text
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for Text
const ALIGN: usize = _;type Init = T;unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> Read<Exclusive, BecauseExclusive> for Text
where
T: ?Sized,
impl<T> ToOwned for Text
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for Text
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for Text
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Text
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Text
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>