[−][src]Enum rustpython_vm::function::OptionalArg
An argument that may or may not be provided by the caller.
This style of argument is not possible in pure Python.
Variants
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]
Self: Debug,
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
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>>
Trait Implementations
impl<T: Clone> Clone for OptionalArg<T>
fn clone(&self) -> Self
fn clone_from(&mut self, source: &Self)
impl<T: Debug> Debug for OptionalArg<T>
[src]
impl<T> Default for OptionalArg<T>
fn default() -> OptionalArg<T>
impl<'a, T> From<&'a OptionalArg<T>> for OptionalArg<&'a T>
fn from(o: &'a OptionalArg<T>) -> OptionalArg<&'a T>
impl<'a, T> From<&'a mut OptionalArg<T>> for OptionalArg<&'a mut T>
fn from(o: &'a mut OptionalArg<T>) -> OptionalArg<&'a mut T>
impl<T> From<T> for OptionalArg<T>
fn from(val: T) -> OptionalArg<T>
impl<T> FromArgs for OptionalArg<T> where
T: TryFromObject,
[src]
T: TryFromObject,
fn arity() -> RangeInclusive<usize>
[src]
fn from_args(
vm: &VirtualMachine,
args: &mut PyFuncArgs
) -> Result<Self, ArgumentError>
[src]
vm: &VirtualMachine,
args: &mut PyFuncArgs
) -> Result<Self, ArgumentError>
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?
fn into_iter(self) -> IntoIter<T>
impl<T> OptionLike<T> for OptionalArg<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for OptionalArg<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for OptionalArg<T> where
T: Send,
T: Send,
impl<T> Sync for OptionalArg<T> where
T: Sync,
T: Sync,
impl<T> Unpin for OptionalArg<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for OptionalArg<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T> FromArgs for T where
T: TryFromObject,
[src]
T: TryFromObject,
fn arity() -> RangeInclusive<usize>
[src]
fn from_args(&VirtualMachine, &mut PyFuncArgs) -> Result<T, ArgumentError>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
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?
fn into_iter(self) -> I
[src]
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>,
T: IntoIterator,
<T as IntoIterator>::Item: Borrow<f64>,
fn min(self) -> f64
fn max(self) -> f64
fn abs_min(self) -> f64
fn abs_max(self) -> f64
fn mean(self) -> f64
fn geometric_mean(self) -> f64
fn harmonic_mean(self) -> f64
fn variance(self) -> f64
fn std_dev(self) -> f64
fn population_variance(self) -> f64
fn population_std_dev(self) -> f64
fn covariance(self, other: T) -> f64
fn population_covariance(self, other: T) -> f64
fn quadratic_mean(self) -> f64
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,