pub struct TextDiff { /* private fields */ }Expand description
Implementations§
Source§impl TextDiff
impl TextDiff
Sourcepub fn try_create(context: &Context) -> CteResult<Self>
pub fn try_create(context: &Context) -> CteResult<Self>
Creates a text diff bound to context.
Sourcepub fn create(context: &Context) -> Self
pub fn create(context: &Context) -> Self
Creates a text diff and panics if native allocation fails.
Sourcepub fn context_id(&self) -> ContextId
pub fn context_id(&self) -> ContextId
Returns the stable identity of the owning Dear ImGui context.
Sourcepub unsafe fn as_raw(&self) -> *mut TextDiff
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.
Sourcepub fn set_text(&mut self, left: &str, right: &str) -> CteResult<()>
pub fn set_text(&mut self, left: &str, right: &str) -> CteResult<()>
Replaces both documents after validating both strings.
Sourcepub fn set_tab_size(&mut self, value: usize) -> CteResult<()>
pub fn set_tab_size(&mut self, value: usize) -> CteResult<()>
Sets the tab width in columns, in 1..=255 to fit upstream glyph storage.
pub fn tab_size(&self) -> usize
Sourcepub fn set_line_spacing(&mut self, value: f32) -> CteResult<()>
pub fn set_line_spacing(&mut self, value: f32) -> CteResult<()>
Sets line spacing. The native widget clamps finite values to 1.0..=2.0.
pub fn line_spacing(&self) -> f32
pub fn set_language(&mut self, language: Option<Language>)
pub fn language(&self) -> Option<Language>
Sourcepub fn set_colors(&mut self, added: u32, deleted: u32)
pub fn set_colors(&mut self, added: u32, deleted: u32)
Sets the packed ImGui colors used for added and deleted lines.
Sourcepub fn set_palette(&mut self, palette: &Palette) -> CteResult<()>
pub fn set_palette(&mut self, palette: &Palette) -> CteResult<()>
Copies a Rust palette into the text diff.