◐ Shell
clean mode source ↗

rustpython_vm::obj::objint::PyInt - Rust

int(x=0) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int('0b100', base=0) 4

impl PyInt[src]

pub fn new<T: Into<BigInt>>(i: T) -> Self[src]

pub fn as_bigint(&self) -> &BigInt[src]

impl PyInt[src]

pub fn xor(
    &self,
    other: PyObjectRef,
    vm: &VirtualMachine
) -> PyArithmaticValue<BigInt>
[src]

pub fn or(
    &self,
    other: PyObjectRef,
    vm: &VirtualMachine
) -> PyArithmaticValue<BigInt>
[src]

pub fn and(
    &self,
    other: PyObjectRef,
    vm: &VirtualMachine
) -> PyArithmaticValue<BigInt>
[src]

pub fn hash(&self) -> i64[src]

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<T> for T[src]

fn from(t: T) -> T[src]

Performs the conversion.

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

fn into(self) -> U[src]

Performs the conversion.

impl<T> IntoPyObject for T where
    T: PyValue
[src]

fn into_pyobject(
    Self,
    &VirtualMachine
) -> Result<Rc<PyObject<dyn PyObjectPayload + 'static>>, PyRef<PyBaseException>>
[src]

impl<T> PyObjectPayload for T where
    T: 'static + PyValue
[src]

fn as_any(&Self) -> &(dyn Any + 'static)[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

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

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

fn vzip(self) -> V