Remove redundant lifetimes
This commit is contained in:
parent
63d6d4c0e2
commit
a058eb5201
|
@ -321,10 +321,10 @@ where
|
||||||
/// This trait is similar to `std::convert::TryFrom`
|
/// This trait is similar to `std::convert::TryFrom`
|
||||||
pub trait PyTryFrom<'v>: Sized + PyNativeType {
|
pub trait PyTryFrom<'v>: Sized + PyNativeType {
|
||||||
/// Cast from a concrete Python object type to PyObject.
|
/// Cast from a concrete Python object type to PyObject.
|
||||||
fn try_from<'b, V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>>;
|
fn try_from<V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>>;
|
||||||
|
|
||||||
/// Cast from a concrete Python object type to PyObject. With exact type check.
|
/// Cast from a concrete Python object type to PyObject. With exact type check.
|
||||||
fn try_from_exact<'b, V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>>;
|
fn try_from_exact<V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>>;
|
||||||
|
|
||||||
/// Cast a PyAny to a specific type of PyObject. The caller must
|
/// Cast a PyAny to a specific type of PyObject. The caller must
|
||||||
/// have already verified the reference is for this type.
|
/// have already verified the reference is for this type.
|
||||||
|
@ -358,7 +358,7 @@ impl<'v, T> PyTryFrom<'v> for T
|
||||||
where
|
where
|
||||||
T: PyTypeInfo + PyNativeType,
|
T: PyTypeInfo + PyNativeType,
|
||||||
{
|
{
|
||||||
fn try_from<'b, V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>> {
|
fn try_from<V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>> {
|
||||||
let value = value.into();
|
let value = value.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
if T::is_instance(value) {
|
if T::is_instance(value) {
|
||||||
|
@ -369,7 +369,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_from_exact<'b, V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>> {
|
fn try_from_exact<V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>> {
|
||||||
let value = value.into();
|
let value = value.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
if T::is_exact_instance(value) {
|
if T::is_exact_instance(value) {
|
||||||
|
@ -390,7 +390,7 @@ impl<'v, T> PyTryFrom<'v> for PyCell<T>
|
||||||
where
|
where
|
||||||
T: 'v + PyClass,
|
T: 'v + PyClass,
|
||||||
{
|
{
|
||||||
fn try_from<'b, V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>> {
|
fn try_from<V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>> {
|
||||||
let value = value.into();
|
let value = value.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
if T::is_instance(value) {
|
if T::is_instance(value) {
|
||||||
|
@ -400,7 +400,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn try_from_exact<'b, V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>> {
|
fn try_from_exact<V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError<'v>> {
|
||||||
let value = value.into();
|
let value = value.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
if T::is_exact_instance(value) {
|
if T::is_exact_instance(value) {
|
||||||
|
|
Loading…
Reference in New Issue