pub fn to_string(&self) -> Result<String> {
        if self.data.starts_with(&[0xfe, 0xff]) {
            Ok(String::from(std::str::from_utf8(crate::font::utf16be_to_string(&self.data[2..])?.as_bytes())
                .map_err(|_| PdfError::Utf8Decode)?))
        }
        else {
            Ok(String::from(std::str::from_utf8(&self.data)
                .map_err(|_| PdfError::Utf8Decode)?))
        }
    }
/// without encoding information the PdfString cannot be sensibly decoded into a String
/// converts to a Rust String but only works for valid UTF-8, UTF-16BE and ASCII characters
/// if invalid bytes found an Error is returned
without encoding information the PdfString cannot be sensibly decoded into a String
converts to a Rust String but only works for valid UTF-8, UTF-16BE and ASCII characters
if invalid bytes found an Error is returned
without encoding information the PdfString cannot be sensibly decoded into a String converts to a Rust String but only works for valid UTF - 8 UTF - 16BE and ASCII characters if invalid bytes found an Error is returned
pub fn to_string(&self) -> Result<String> {
        if self.data.starts_with(&[0xfe, 0xff]) {
            Ok(String::from(std::str::from_utf8(crate::font::utf16be_to_string(&self.data[2..])?.as_bytes())
                .map_err(|_| PdfError::Utf8Decode)?))
        }
        else {
            Ok(String::from(std::str::from_utf8(&self.data)
                .map_err(|_| PdfError::Utf8Decode)?))
        }
    }
pub fn to_string ( & self ) -> Result < String > { if self . data . starts_with ( & [ 0xfe , 0xff ] ) { Ok ( String :: from ( std :: str :: from_utf8 ( crate :: font :: utf16be_to_string ( & self . data [ 2 .. ] ) ? . as_bytes ( ) ) . map_err ( | _ | PdfError :: Utf8Decode ) ? ) ) } else { Ok ( String :: from ( std :: str :: from_utf8 ( & self . data ) . map_err ( | _ | PdfError :: Utf8Decode ) ? ) ) } }
without encoding information the PdfString cannot be sensibly decoded into a String
converts to a Rust String but only works for valid UTF-8, UTF-16BE and ASCII characters
if invalid bytes found an Error is returned
without encoding information the PdfString cannot be sensibly decoded into a String converts to a Rust String but only works for valid UTF - 8 UTF - 16BE and ASCII characters if invalid bytes found an Error is returned
&self
&self