Fix breaks
This commit is contained in:
parent
87fc848bfc
commit
5a698fe65d
1 changed files with 3 additions and 3 deletions
|
|
@ -21,7 +21,7 @@ fn extract_text_with_cursors(input: &Bound<'_, PyAny>) -> PyResult<TextWithCurso
|
||||||
return Ok(TextWithCursors::from(text));
|
return Ok(TextWithCursors::from(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
let dict = input.downcast::<PyDict>()?;
|
let dict = input.cast::<PyDict>()?;
|
||||||
|
|
||||||
let text: String = dict
|
let text: String = dict
|
||||||
.get_item("text")?
|
.get_item("text")?
|
||||||
|
|
@ -30,10 +30,10 @@ fn extract_text_with_cursors(input: &Bound<'_, PyAny>) -> PyResult<TextWithCurso
|
||||||
|
|
||||||
let cursors = match dict.get_item("cursors")? {
|
let cursors = match dict.get_item("cursors")? {
|
||||||
Some(obj) if !obj.is_none() => {
|
Some(obj) if !obj.is_none() => {
|
||||||
let list = obj.downcast::<PyList>()?;
|
let list = obj.cast::<PyList>()?;
|
||||||
let mut cursors = Vec::with_capacity(list.len());
|
let mut cursors = Vec::with_capacity(list.len());
|
||||||
for item in list {
|
for item in list {
|
||||||
let cursor_dict = item.downcast::<PyDict>()?;
|
let cursor_dict = item.cast::<PyDict>()?;
|
||||||
let id: usize = cursor_dict
|
let id: usize = cursor_dict
|
||||||
.get_item("id")?
|
.get_item("id")?
|
||||||
.ok_or_else(|| pyo3::exceptions::PyKeyError::new_err("id"))?
|
.ok_or_else(|| pyo3::exceptions::PyKeyError::new_err("id"))?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue