pub struct ExcelString { /* private fields */ }Expand description
Owned UTF-16 payload independent of Excel callback memory.
The box contains payload code units only: no Excel length prefix and no trailing NUL requirement. Arbitrary UTF-16 code units are preserved.
Implementations§
Source§impl ExcelString
impl ExcelString
Sourcepub fn from_borrowed(value: ExcelValueRef<'_>) -> Result<Self, ConversionError>
pub fn from_borrowed(value: ExcelValueRef<'_>) -> Result<Self, ConversionError>
Copies callback UTF-16 using ConversionLimits::default.
Sourcepub fn from_borrowed_with_limits(
value: ExcelValueRef<'_>,
limits: &ConversionLimits,
) -> Result<Self, ConversionError>
pub fn from_borrowed_with_limits( value: ExcelValueRef<'_>, limits: &ConversionLimits, ) -> Result<Self, ConversionError>
Copies callback UTF-16 directly, without an intermediate UTF-8 string.
Source§impl ExcelString
impl ExcelString
Sourcepub fn from_utf16_units(units: impl Into<Box<[u16]>>) -> Self
pub fn from_utf16_units(units: impl Into<Box<[u16]>>) -> Self
Owns the supplied UTF-16 code units without validating Unicode scalar values. Conversion limits apply when callback memory is copied, not to semantic strings constructed directly by Rust callers.
Sourcepub fn as_utf16(&self) -> &[u16]
pub fn as_utf16(&self) -> &[u16]
Returns the exact owned UTF-16 code units, including embedded NULs.
Sourcepub const fn len_utf16(&self) -> usize
pub const fn len_utf16(&self) -> usize
Returns the number of UTF-16 code units, not Unicode scalar values.
Sourcepub fn to_string(&self) -> Result<String, Utf16ConversionError>
pub fn to_string(&self) -> Result<String, Utf16ConversionError>
Strictly decodes the UTF-16 payload.
Sourcepub fn to_string_lossy(&self) -> String
pub fn to_string_lossy(&self) -> String
Explicitly decodes the payload, replacing unpaired surrogates with the Unicode replacement character.