Struct rustpython_vm::function::ArgIntoBool
source · pub struct ArgIntoBool { /* private fields */ }
Expand description
A Python bool-like object.
ArgIntoBool
implements FromArgs
so that a built-in function can accept
any object that can be transformed into a boolean.
By default an object is considered true unless its class defines either a
__bool__()
method that returns False or a __len__()
method that returns
zero, when called with the object.
Implementations§
Trait Implementations§
source§impl Debug for ArgIntoBool
impl Debug for ArgIntoBool
source§impl Default for ArgIntoBool
impl Default for ArgIntoBool
source§fn default() -> ArgIntoBool
fn default() -> ArgIntoBool
Returns the “default value” for a type. Read more
source§impl Deref for ArgIntoBool
impl Deref for ArgIntoBool
source§impl From<ArgIntoBool> for bool
impl From<ArgIntoBool> for bool
source§fn from(arg: ArgIntoBool) -> Self
fn from(arg: ArgIntoBool) -> Self
Converts to this type from the input type.
source§impl PartialEq<ArgIntoBool> for ArgIntoBool
impl PartialEq<ArgIntoBool> for ArgIntoBool
source§fn eq(&self, other: &ArgIntoBool) -> bool
fn eq(&self, other: &ArgIntoBool) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl TryFromObject for ArgIntoBool
impl TryFromObject for ArgIntoBool
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 Eq for ArgIntoBool
impl StructuralEq for ArgIntoBool
impl StructuralPartialEq for ArgIntoBool
Auto Trait Implementations§
impl RefUnwindSafe for ArgIntoBool
impl Send for ArgIntoBool
impl Sync for ArgIntoBool
impl Unpin for ArgIntoBool
impl UnwindSafe for ArgIntoBool
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> ExactFrom<T> for Uwhere U: TryFrom<T>,
fn exact_from(value: T) -> U
§impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
impl<T, U> ExactInto<U> for Twhere U: ExactFrom<T>,
fn exact_into(self) -> U
source§impl<T> FromArgOptional for Twhere
T: TryFromObject,
impl<T> FromArgOptional for Twhere T: TryFromObject,
type Inner = T
fn from_inner(x: T) -> T
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).