mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-01 06:10:07 -04:00
winit-core/ime: implement Error for ImeSurroundingTextError
This commit is contained in:
@@ -1691,6 +1691,22 @@ pub enum ImeSurroundingTextError {
|
|||||||
AnchorBadPosition,
|
AnchorBadPosition,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for ImeSurroundingTextError {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
ImeSurroundingTextError::TextTooLong => write!(f, "text exceeds maximum length"),
|
||||||
|
ImeSurroundingTextError::CursorBadPosition => {
|
||||||
|
write!(f, "cursor is not at a valid text index")
|
||||||
|
},
|
||||||
|
ImeSurroundingTextError::AnchorBadPosition => {
|
||||||
|
write!(f, "anchor is not at a valid text index")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::error::Error for ImeSurroundingTextError {}
|
||||||
|
|
||||||
/// Defines the text surrounding the caret
|
/// Defines the text surrounding the caret
|
||||||
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
|
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
|||||||
Reference in New Issue
Block a user