TextAnalysis

Struct TextAnalysis 

Source
pub struct TextAnalysis<'a> { /* private fields */ }
Available on crate feature analysis only.
Expand description

Analysis results for dialogue text content

Contains extracted plain text, override tag information, and Unicode complexity indicators. Uses zero-copy references where possible.

Implementations§

Source§

impl<'a> TextAnalysis<'a>

Source

pub fn analyze(text: &'a str) -> Result<Self>

Analyze dialogue text content comprehensively

Extracts plain text, parses override tags, and analyzes Unicode complexity. Uses zero-copy references for tag arguments.

§Arguments
  • text - Original dialogue text with potential override tags
§Returns

Complete text analysis results or parsing error.

§Example
let text = "Hello {\\b1}world{\\b0}!";
let analysis = TextAnalysis::analyze(text)?;
assert_eq!(analysis.plain_text(), "Hello world!");
assert_eq!(analysis.override_tags().len(), 2);
§Errors

Returns an error if text parsing fails or contains invalid override tags.

Source

pub fn analyze_with_registry( text: &'a str, registry: Option<&ExtensionRegistry>, ) -> Result<Self>

Available on crate feature plugins only.

Analyze dialogue text content with extension registry support

Same as analyze but allows custom tag handlers via registry. Unhandled tags fall back to standard processing.

§Arguments
  • text - Original dialogue text with potential override tags
  • registry - Optional registry for custom tag handlers
§Returns

Complete text analysis results or parsing error.

§Errors

Returns an error if text parsing fails or contains invalid override tags.

Source

pub fn plain_text(&self) -> &str

Get plain text without override tags

Source

pub const fn char_count(&self) -> usize

Get Unicode character count

Source

pub const fn line_count(&self) -> usize

Get line count after processing linebreaks

Source

pub const fn has_bidi_text(&self) -> bool

Check if text contains bidirectional content

Source

pub const fn has_complex_unicode(&self) -> bool

Check if text contains complex Unicode beyond basic Latin

Source

pub fn override_tags(&self) -> &[OverrideTag<'a>]

Get parsed override tags

Source

pub fn diagnostics(&self) -> &[TagDiagnostic<'a>]

Get parse diagnostics collected during analysis

Trait Implementations§

Source§

impl<'a> Clone for TextAnalysis<'a>

Source§

fn clone(&self) -> TextAnalysis<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for TextAnalysis<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for TextAnalysis<'a>

§

impl<'a> RefUnwindSafe for TextAnalysis<'a>

§

impl<'a> Send for TextAnalysis<'a>

§

impl<'a> Sync for TextAnalysis<'a>

§

impl<'a> Unpin for TextAnalysis<'a>

§

impl<'a> UnwindSafe for TextAnalysis<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.