Implement missing debug implementations in iced_widget

This commit is contained in:
Héctor Ramón Jiménez 2023-10-27 05:08:06 +02:00
parent 625cd745f3
commit e579d85530
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 18 additions and 1 deletions

View file

@ -4,7 +4,7 @@
)] )]
#![forbid(unsafe_code, rust_2018_idioms)] #![forbid(unsafe_code, rust_2018_idioms)]
#![deny( #![deny(
//missing_debug_implementations, missing_debug_implementations,
missing_docs, missing_docs,
unused_results, unused_results,
rustdoc::broken_intra_doc_links rustdoc::broken_intra_doc_links

View file

@ -14,6 +14,7 @@ use crate::core::{
}; };
use std::cell::RefCell; use std::cell::RefCell;
use std::fmt;
use std::ops::DerefMut; use std::ops::DerefMut;
use std::sync::Arc; use std::sync::Arc;
@ -21,6 +22,7 @@ pub use crate::style::text_editor::{Appearance, StyleSheet};
pub use text::editor::{Action, Edit, Motion}; pub use text::editor::{Action, Edit, Motion};
/// A multi-line text input. /// A multi-line text input.
#[allow(missing_debug_implementations)]
pub struct TextEditor<'a, Highlighter, Message, Renderer = crate::Renderer> pub struct TextEditor<'a, Highlighter, Message, Renderer = crate::Renderer>
where where
Highlighter: text::Highlighter, Highlighter: text::Highlighter,
@ -257,6 +259,21 @@ where
} }
} }
impl<Renderer> fmt::Debug for Content<Renderer>
where
Renderer: text::Renderer,
Renderer::Editor: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let internal = self.0.borrow();
f.debug_struct("Content")
.field("editor", &internal.editor)
.field("is_dirty", &internal.is_dirty)
.finish()
}
}
struct State<Highlighter: text::Highlighter> { struct State<Highlighter: text::Highlighter> {
is_focused: bool, is_focused: bool,
last_click: Option<mouse::Click>, last_click: Option<mouse::Click>,