[][src]Enum rustpython_vm::function::OptionalArg

pub enum OptionalArg<T = PyObjectRef> {
    Present(T),
    Missing,
}

An argument that may or may not be provided by the caller.

This style of argument is not possible in pure Python.

Variants

Present(T)
Missing

Methods

impl<T> OptionalArg<T>[src]

pub fn is_present(&self) -> bool[src]

Returns true if self is of variant Present.

pub fn expect_present(self) -> T where
    Self: Debug
[src]

Unwraps the value, yielding the content of Present.

Panics

Panics if the value is not Present, with a panic message including the content of self.

pub fn present(self) -> Option<T>[src]

Returns Some if self is of variant Present, and None otherwise.

pub fn is_missing(&self) -> bool[src]

Returns true if self is of variant Missing.

impl<T> OptionalArg<T>

pub fn from_option(option: Option<T>) -> Self

pub fn into_option(self) -> Option<T>

pub fn as_option(&self) -> Option<&T>

pub fn as_option_mut(&mut self) -> Option<&mut T>

pub fn as_ref(&self) -> OptionalArg<&T>

pub fn as_mut(&mut self) -> OptionalArg<&mut T>

pub fn expect(self, msg: &str) -> T

pub fn unwrap(self) -> T

pub fn unwrap_or(self, default: T) -> T

pub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T

pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> OptionalArg<U>

pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U

pub fn map_or_else<U, D: FnOnce() -> U, F: FnOnce(T) -> U>(
    self,
    default: D,
    f: F
) -> U

pub fn ok_or<E>(self, err: E) -> Result<T, E>

pub fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E>

pub fn and<U>(self, optb: OptionalArg<U>) -> OptionalArg<U>

pub fn and_then<U, F: FnOnce(T) -> OptionalArg<U>>(self, f: F) -> OptionalArg<U>

pub fn filter<P: FnOnce(&T) -> bool>(self, predicate: P) -> Self

pub fn or(self, optb: OptionalArg<T>) -> OptionalArg<T>

pub fn or_else<F: FnOnce() -> OptionalArg<T>>(self, f: F) -> OptionalArg<T>

pub fn xor(self, optb: OptionalArg<T>) -> OptionalArg<T>

pub fn get_or_insert(&mut self, v: T) -> &mut T

pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T

pub fn take(&mut self) -> Self

pub fn replace(&mut self, value: T) -> Self

impl<'_, T: Copy> OptionalArg<&'_ T>

pub fn copied(self) -> OptionalArg<T>

impl<'_, T: Copy> OptionalArg<&'_ mut T>

pub fn copied(self) -> OptionalArg<T>

impl<'_, T: Clone> OptionalArg<&'_ T>

pub fn cloned(self) -> OptionalArg<T>

impl<'_, T: Clone> OptionalArg<&'_ mut T>

pub fn cloned(self) -> OptionalArg<T>

impl<T: Default> OptionalArg<T>

pub fn unwrap_or_default(self) -> T

impl<T: Deref> OptionalArg<T>

pub fn as_deref(&self) -> OptionalArg<&T::Target>

impl<T: DerefMut> OptionalArg<T>

pub fn as_deref_mut(&mut self) -> OptionalArg<&mut T::Target>

impl<T, E> OptionalArg<Result<T, E>>

pub fn transpose(self) -> Result<Option<T>, E>

Trait Implementations

impl<T: Clone> Clone for OptionalArg<T>

impl<T: Debug> Debug for OptionalArg<T>[src]

impl<T> Default for OptionalArg<T>

impl<'a, T> From<&'a OptionalArg<T>> for OptionalArg<&'a T>

impl<'a, T> From<&'a mut OptionalArg<T>> for OptionalArg<&'a mut T>

impl<T> From<T> for OptionalArg<T>

impl<T> FromArgs for OptionalArg<T> where
    T: TryFromObject
[src]

impl<T> IntoIterator for OptionalArg<T>

type Item = T

The type of the elements being iterated over.

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?

impl<T> OptionLike<T> for OptionalArg<T>

Auto Trait Implementations

impl<T> RefUnwindSafe for OptionalArg<T> where
    T: RefUnwindSafe

impl<T> Send for OptionalArg<T> where
    T: Send

impl<T> Sync for OptionalArg<T> where
    T: Sync

impl<T> Unpin for OptionalArg<T> where
    T: Unpin

impl<T> UnwindSafe for OptionalArg<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T> FromArgs for T where
    T: TryFromObject
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Statistics<f64> for T where
    T: IntoIterator,
    <T as IntoIterator>::Item: Borrow<f64>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy