Struct CastIntoError
pub struct CastIntoError<'py> { /* private fields */ }Available on crate feature
tls only.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.
Implementations§
§impl<'py> CastIntoError<'py>
impl<'py> CastIntoError<'py>
pub fn new(
from: Bound<'py, PyAny>,
classinfo: Bound<'py, PyAny>,
) -> CastIntoError<'py>
pub fn new( from: Bound<'py, PyAny>, classinfo: Bound<'py, PyAny>, ) -> CastIntoError<'py>
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.
pub 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§
§impl<'py> Debug for CastIntoError<'py>
impl<'py> Debug for CastIntoError<'py>
§impl Display for CastIntoError<'_>
impl Display for CastIntoError<'_>
§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
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
§impl From<CastIntoError<'_>> for PyErr
Convert CastIntoError to Python TypeError.
impl From<CastIntoError<'_>> for PyErr
Convert CastIntoError to Python TypeError.
§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more