pub struct ArgIntoFloat { /* private fields */ }Expand description
A Python float-like object.
ArgIntoFloat implements FromArgs so that a built-in function can accept
any object that can be transformed into a float.
If the object is not a Python floating point object but has a __float__()
method, this method will first be called to convert the object into a float.
If __float__() is not defined then it falls back to __index__().
Implementations§
Source§impl ArgIntoFloat
impl ArgIntoFloat
pub fn into_float(self) -> f64
pub fn vec_into_f64(v: Vec<Self>) -> Vec<f64>
Trait Implementations§
Source§impl Debug for ArgIntoFloat
impl Debug for ArgIntoFloat
Source§impl From<ArgIntoFloat> for f64
impl From<ArgIntoFloat> for f64
Source§fn from(arg: ArgIntoFloat) -> Self
fn from(arg: ArgIntoFloat) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ArgIntoFloat
impl PartialEq for ArgIntoFloat
Source§impl TryFromObject for ArgIntoFloat
impl TryFromObject for ArgIntoFloat
Source§fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self>
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self>
Attempt to convert a Python object to a value of this type.
impl StructuralPartialEq for ArgIntoFloat
Auto Trait Implementations§
impl Freeze for ArgIntoFloat
impl RefUnwindSafe for ArgIntoFloat
impl Send for ArgIntoFloat
impl Sync for ArgIntoFloat
impl Unpin for ArgIntoFloat
impl UnsafeUnpin for ArgIntoFloat
impl UnwindSafe for ArgIntoFloat
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> FromArgOptional for Twhere
T: TryFromObject,
impl<T> FromArgOptional for Twhere
T: TryFromObject,
Source§impl<T> FromArgs for Twhere
T: TryFromObject,
impl<T> FromArgs for Twhere
T: TryFromObject,
Source§fn arity() -> RangeInclusive<usize>
fn arity() -> RangeInclusive<usize>
The range of positional arguments permitted by the function signature. Read more
Source§fn from_args(
vm: &VirtualMachine,
args: &mut FuncArgs,
) -> Result<T, ArgumentError>
fn from_args( vm: &VirtualMachine, args: &mut FuncArgs, ) -> Result<T, ArgumentError>
Extracts this item from the next argument(s).
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