| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0f24d66 commit f314328
15 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,8 +86,8 @@ python_person.name: {}", | |||
| 86 | 86 | name: String, | |
| 87 | 87 | } | |
| 88 | 88 | ||
| 89 | - impl TryFromBorrowedObject for PythonPerson { | ||
| 90 | - fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> { | ||
| 89 | + impl<'a> TryFromBorrowedObject<'a> for PythonPerson { | ||
| 90 | + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { | ||
| 91 | 91 | let name = obj.get_attr("name", vm)?.try_into_value::<String>(vm)?; | |
| 92 | 92 | Ok(PythonPerson { name }) | |
| 93 | 93 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,8 +72,8 @@ mod mmap { | |||
| 72 | 72 | Copy = 3, | |
| 73 | 73 | } | |
| 74 | 74 | ||
| 75 | - impl TryFromBorrowedObject for AccessMode { | ||
| 76 | - fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> { | ||
| 75 | + impl<'a> TryFromBorrowedObject<'a> for AccessMode { | ||
| 76 | + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { | ||
| 77 | 77 | let i = u32::try_from_borrowed_object(vm, obj)?; | |
| 78 | 78 | Ok(match i { | |
| 79 | 79 | 0 => Self::Default, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -129,8 +129,8 @@ mod resource { | |||
| 129 | 129 | } | |
| 130 | 130 | ||
| 131 | 131 | struct Limits(libc::rlimit); | |
| 132 | - impl TryFromBorrowedObject for Limits { | ||
| 133 | - fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> { | ||
| 132 | + impl<'a> TryFromBorrowedObject<'a> for Limits { | ||
| 133 | + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { | ||
| 134 | 134 | let seq: Vec<libc::rlim_t> = obj.try_to_value(vm)?; | |
| 135 | 135 | match *seq { | |
| 136 | 136 | [cur, max] => Ok(Self(libc::rlimit { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,8 +41,8 @@ enum NormalizeForm { | |||
| 41 | 41 | Nfkd, | |
| 42 | 42 | } | |
| 43 | 43 | ||
| 44 | - impl TryFromBorrowedObject for NormalizeForm { | ||
| 45 | - fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> { | ||
| 44 | + impl<'a> TryFromBorrowedObject<'a> for NormalizeForm { | ||
| 45 | + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { | ||
| 46 | 46 | obj.try_value_with( | |
| 47 | 47 | |form: &PyStr| { | |
| 48 | 48 | Ok(match form.as_str() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -581,8 +581,8 @@ mod zlib { | |||
| 581 | 581 | } | |
| 582 | 582 | } | |
| 583 | 583 | ||
| 584 | - impl TryFromBorrowedObject for Level { | ||
| 585 | - fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> { | ||
| 584 | + impl<'a> TryFromBorrowedObject<'a> for Level { | ||
| 585 | + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { | ||
| 586 | 586 | let int: i32 = obj.try_index(vm)?.try_to_primitive(vm)?; | |
| 587 | 587 | Ok(Self::new(int)) | |
| 588 | 588 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,8 +19,8 @@ impl ToPyObject for bool { | |||
| 19 | 19 | } | |
| 20 | 20 | } | |
| 21 | 21 | ||
| 22 | - impl TryFromBorrowedObject for bool { | ||
| 23 | - fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<bool> { | ||
| 22 | + impl<'a> TryFromBorrowedObject<'a> for bool { | ||
| 23 | + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<bool> { | ||
| 24 | 24 | if obj.fast_isinstance(vm.ctx.types.int_type) { | |
| 25 | 25 | Ok(get_value(obj)) | |
| 26 | 26 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -742,8 +742,8 @@ impl IterNext for PyBytesIterator { | |||
| 742 | 742 | } | |
| 743 | 743 | } | |
| 744 | 744 | ||
| 745 | - impl TryFromBorrowedObject for PyBytes { | ||
| 746 | - fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> { | ||
| 745 | + impl<'a> TryFromBorrowedObject<'a> for PyBytes { | ||
| 746 | + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { | ||
| 747 | 747 | PyBytesInner::try_from_borrowed_object(vm, obj).map(|x| x.into()) | |
| 748 | 748 | } | |
| 749 | 749 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,8 +72,8 @@ impl_into_pyobject_int!(isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 BigI | |||
| 72 | 72 | ||
| 73 | 73 | macro_rules! impl_try_from_object_int { | |
| 74 | 74 | ($(($t:ty, $to_prim:ident),)*) => {$( | |
| 75 | - impl TryFromBorrowedObject for $t { | ||
| 76 | - fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> { | ||
| 75 | + impl<'a> TryFromBorrowedObject<'a> for $t { | ||
| 76 | + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { | ||
| 77 | 77 | obj.try_value_with(|int: &PyInt| { | |
| 78 | 78 | int.try_to_primitive(vm) | |
| 79 | 79 | }, vm) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,8 +42,8 @@ use unic_ucd_category::GeneralCategory; | |||
| 42 | 42 | use unic_ucd_ident::{is_xid_continue, is_xid_start}; | |
| 43 | 43 | use unicode_casing::CharExt; | |
| 44 | 44 | ||
| 45 | - impl TryFromBorrowedObject for String { | ||
| 46 | - fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> { | ||
| 45 | + impl<'a> TryFromBorrowedObject<'a> for String { | ||
| 46 | + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { | ||
| 47 | 47 | obj.try_value_with(|pystr: &PyStr| Ok(pystr.as_str().to_owned()), vm) | |
| 48 | 48 | } | |
| 49 | 49 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,8 +30,8 @@ impl From<Vec<u8>> for PyBytesInner { | |||
| 30 | 30 | } | |
| 31 | 31 | } | |
| 32 | 32 | ||
| 33 | - impl TryFromBorrowedObject for PyBytesInner { | ||
| 34 | - fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> { | ||
| 33 | + impl<'a> TryFromBorrowedObject<'a> for PyBytesInner { | ||
| 34 | + fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { | ||
| 35 | 35 | bytes_from_object(vm, obj).map(Self::from) | |
| 36 | 36 | } | |
| 37 | 37 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments