pub struct CastIntoError<'py> {
from: Bound<'py, PyAny>,
classinfo: Bound<'py, PyAny>,
}Expand description
Equivalent to CastError for operations where the smart pointer cast transfers ownership
of the original object.
The original object can be retrieved using into_inner.
Fields§
§from: Bound<'py, PyAny>§classinfo: Bound<'py, PyAny>Implementations§
Source§impl<'py> CastIntoError<'py>
impl<'py> CastIntoError<'py>
Sourcepub fn new(from: Bound<'py, PyAny>, classinfo: Bound<'py, PyAny>) -> Self
pub fn new(from: Bound<'py, PyAny>, classinfo: Bound<'py, PyAny>) -> Self
Create a new CastError representing a failure to interpret a smart pointer to
from as a type from the given classinfo.
Equivalent to CastError::new for owned objects.
Sourcepub fn into_inner(self) -> Bound<'py, PyAny>
pub fn into_inner(self) -> Bound<'py, PyAny>
Consumes this CastIntoError and returns the original object, allowing continued
use of it after a failed conversion.
See cast_into for an example.
Trait Implementations§
Source§impl<'py> Debug for CastIntoError<'py>
impl<'py> Debug for CastIntoError<'py>
Source§impl Display for CastIntoError<'_>
impl Display for CastIntoError<'_>
Source§impl Error for CastIntoError<'_>
impl Error for CastIntoError<'_>
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
Source§#[doc(hidden)]fn type_id(&self, _: Internal) -> TypeIdwhere
Self: 'static,
#[doc(hidden)]fn type_id(&self, _: Internal) -> TypeIdwhere
Self: 'static,
🔬This is a nightly-only experimental API. (
error_type_id)Gets the
TypeId of self.1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<CastIntoError<'_>> for PyErr
Convert CastIntoError to Python TypeError.
impl From<CastIntoError<'_>> for PyErr
Convert CastIntoError to Python TypeError.
Source§fn from(err: CastIntoError<'_>) -> PyErr
fn from(err: CastIntoError<'_>) -> PyErr
Converts to this type from the input type.
Auto Trait Implementations§
impl<'py> Freeze for CastIntoError<'py>
impl<'py> !RefUnwindSafe for CastIntoError<'py>
impl<'py> !Send for CastIntoError<'py>
impl<'py> !Sync for CastIntoError<'py>
impl<'py> Unpin for CastIntoError<'py>
impl<'py> UnsafeUnpin for CastIntoError<'py>
impl<'py> UnwindSafe for CastIntoError<'py>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
🔬This is a nightly-only experimental API. (
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)The largest safe length for a
[Self]. Read more