pub struct NotRequired<T>(pub Option<T>);Available on crate feature
unstable-from-py-dict only.Expand description
Inspired by typing.NotRequired
See also: derive_from_py_dict.
Tuple Fields§
§0: Option<T>Implementations§
Source§impl<'py, T> NotRequired<T>
impl<'py, T> NotRequired<T>
Sourcepub fn into_py_with(
f: impl FnOnce(Python<'py>) -> PyResult<Bound<'py, PyAny>>,
) -> impl FnOnce(Cow<'_, Self>, Python<'py>) -> PyResult<Bound<'py, PyAny>>
pub fn into_py_with( f: impl FnOnce(Python<'py>) -> PyResult<Bound<'py, PyAny>>, ) -> impl FnOnce(Cow<'_, Self>, Python<'py>) -> PyResult<Bound<'py, PyAny>>
You should always specify the type T like NotRequired::IntoPyObject error.
Sourcepub fn into_py_with_none(
slf: Cow<'_, Self>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyAny>>
pub fn into_py_with_none( slf: Cow<'_, Self>, py: Python<'py>, ) -> PyResult<Bound<'py, PyAny>>
See also: NotRequired::into_py_with
Sourcepub fn into_py_with_default(
slf: Cow<'_, Self>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyAny>>where
T: Default,
pub fn into_py_with_default(
slf: Cow<'_, Self>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyAny>>where
T: Default,
See also: NotRequired::into_py_with
Sourcepub fn into_py_with_err(
slf: Cow<'_, Self>,
py: Python<'py>,
) -> PyResult<Bound<'py, PyAny>>
pub fn into_py_with_err( slf: Cow<'_, Self>, py: Python<'py>, ) -> PyResult<Bound<'py, PyAny>>
See also: NotRequired::into_py_with
Trait Implementations§
Source§impl<T: Clone> Clone for NotRequired<T>
impl<T: Clone> Clone for NotRequired<T>
Source§fn clone(&self) -> NotRequired<T>
fn clone(&self) -> NotRequired<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for NotRequired<T>
impl<T: Debug> Debug for NotRequired<T>
Source§impl<T> Default for NotRequired<T>
impl<T> Default for NotRequired<T>
Source§impl<'py, T> FromPyObject<'py> for NotRequired<T>where
for<'a, 'py_a> T: FromPyObjectBound<'a, 'py_a>,
impl<'py, T> FromPyObject<'py> for NotRequired<T>where
for<'a, 'py_a> T: FromPyObjectBound<'a, 'py_a>,
impl<T: Copy> Copy for NotRequired<T>
Auto Trait Implementations§
impl<T> Freeze for NotRequired<T>where
T: Freeze,
impl<T> RefUnwindSafe for NotRequired<T>where
T: RefUnwindSafe,
impl<T> Send for NotRequired<T>where
T: Send,
impl<T> Sync for NotRequired<T>where
T: Sync,
impl<T> Unpin for NotRequired<T>where
T: Unpin,
impl<T> UnwindSafe for NotRequired<T>where
T: UnwindSafe,
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