Skip to main content

TextDiff

Struct TextDiff 

Source
pub struct TextDiff { /* private fields */ }
Expand description

An owned, context-bound syntax-highlighted text diff.

The diff is intentionally neither Send nor Sync. Every native call is made while its originating Dear ImGui context is current.

Implementations§

Source§

impl TextDiff

Source

pub fn try_create(context: &Context) -> CteResult<Self>

Creates a text diff bound to context.

Source

pub fn create(context: &Context) -> Self

Creates a text diff and panics if native allocation fails.

Source

pub fn context_id(&self) -> ContextId

Returns the stable identity of the owning Dear ImGui context.

Source

pub unsafe fn as_raw(&self) -> *mut TextDiff

Returns the raw text-diff pointer.

§Safety

The pointer may only be used while the owning Dear ImGui context is current. The caller must preserve every cimCTE precondition, ownership and pointer-lifetime rule, and invariant relied on by this safe wrapper. In particular, the caller must not destroy the diff, retain borrowed pointers, set a zero tab size, or install a language pointer that can become invalid.

Source

pub fn set_text(&mut self, left: &str, right: &str) -> CteResult<()>

Replaces both documents after validating both strings.

Source

pub fn set_tab_size(&mut self, value: usize) -> CteResult<()>

Sets the tab width in columns, in 1..=255 to fit upstream glyph storage.

Source

pub fn tab_size(&self) -> usize

Source

pub fn set_line_spacing(&mut self, value: f32) -> CteResult<()>

Sets line spacing. The native widget clamps finite values to 1.0..=2.0.

Source

pub fn line_spacing(&self) -> f32

Source

pub fn set_language(&mut self, language: Option<Language>)

Source

pub fn language(&self) -> Option<Language>

Source

pub fn set_colors(&mut self, added: u32, deleted: u32)

Sets the packed ImGui colors used for added and deleted lines.

Source

pub fn set_palette(&mut self, palette: &Palette) -> CteResult<()>

Copies a Rust palette into the text diff.

Source

pub fn palette(&self) -> Palette

Returns an owned copy of the text-diff palette.

Source

pub fn focus(&mut self)

Requests keyboard focus on the next render.

Source§

impl TextDiff

Source

pub fn set_side_by_side(&mut self, value: bool)

Source

pub fn is_side_by_side(&self) -> bool

Source§

impl TextDiff

Source

pub fn set_word_wrap_enabled(&mut self, value: bool)

Source

pub fn is_word_wrap_enabled(&self) -> bool

Source§

impl TextDiff

Source

pub fn set_show_whitespaces(&mut self, value: bool)

Source

pub fn shows_whitespaces(&self) -> bool

Source§

impl TextDiff

Source

pub fn set_show_spaces(&mut self, value: bool)

Source

pub fn shows_spaces(&self) -> bool

Source§

impl TextDiff

Source

pub fn set_show_tabs(&mut self, value: bool)

Source

pub fn shows_tabs(&self) -> bool

Source§

impl TextDiff

Trait Implementations§

Source§

impl Drop for TextDiff

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.