FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    RichTextDocument

    struct · ferroui-controls · v0.5.0

    struct RichTextDocument
    

    Authoritative structured content shared by read-only and editable text controls. Its plain string is a derived read cache; every mutation changes the block tree.

    View source

    Members

    new

    fn new() -> Self
    

    Source

    with_blocks

    fn with_blocks(blocks: BlockCollection) -> Self
    

    Source

    from_text

    fn from_text(text: &str) -> Self
    

    Source

    blocks

    fn blocks(self: &Self) -> BlockCollection
    

    Source

    revision

    fn revision(self: &Self) -> u64
    

    Source

    downgrade

    fn downgrade(self: &Self) -> WeakRichTextDocument
    

    Source

    paragraphs

    fn paragraphs(self: &Self) -> Vec<Ref<Paragraph>>
    

    Source

    text

    fn text(self: &Self) -> String
    

    Source

    text_length

    fn text_length(self: &Self) -> usize
    

    Source

    changed

    fn changed(self: &Self, handler: impl Fn(&DocumentChangedEventArgs) -> () + 'static) -> Subscription
    

    Dropping the returned guard removes the handler; Subscription::detach keeps it for the life of the document.

    Source

    begin_edit

    fn begin_edit(self: &Self) -> DocumentEditBatch
    

    Nested batches publish one revision and one Changed event at the outer end.

    Source

    snapshot

    fn snapshot(self: &Self) -> DocumentSnapshot
    

    Source

    restore

    fn restore(self: &Self, snapshot: &DocumentSnapshot) -> Result<(), DocumentError>
    

    Source

    validate_range

    fn validate_range(self: &Self, range: Range<usize>) -> Result<(), DocumentError>
    

    Source

    get_text

    fn get_text(self: &Self, range: Range<usize>) -> Result<String, DocumentError>
    

    Source

    slice

    fn slice(self: &Self, range: Range<usize>) -> Result<DocumentSnapshot, DocumentError>
    

    Source

    replace_text

    fn replace_text(self: &Self, range: Range<usize>, text: &str) -> Result<(), DocumentError>
    

    Source

    replace_range

    fn replace_range(self: &Self, range: Range<usize>, fragment: &DocumentSnapshot) -> Result<(), DocumentError>
    

    Source

    apply_format

    fn apply_format(self: &Self, range: Range<usize>, format: &CharacterFormat) -> Result<(), DocumentError>
    

    Source

    apply_paragraph_format

    fn apply_paragraph_format(self: &Self, range: Range<usize>, format: &ParagraphFormat) -> Result<(), DocumentError>
    

    Source

    character_format_at

    fn character_format_at(self: &Self, offset: usize) -> Result<CharacterFormat, DocumentError>
    

    Source

    element_at

    fn element_at(self: &Self, offset: usize, gravity: TextGravity) -> Option<Ref<TextElement>>
    

    Source

    create_pointer

    fn create_pointer(self: &Self, offset: usize, gravity: TextGravity) -> Result<TextPointer, DocumentError>
    

    Source

    is_grapheme_boundary

    fn is_grapheme_boundary(self: &Self, offset: usize) -> bool
    

    Source

    previous_grapheme

    fn previous_grapheme(self: &Self, offset: usize) -> usize
    

    Source

    next_grapheme

    fn next_grapheme(self: &Self, offset: usize) -> usize
    

    Source

    previous_word

    fn previous_word(self: &Self, offset: usize) -> usize
    

    Source

    next_word

    fn next_word(self: &Self, offset: usize) -> usize
    

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.