[][src]Struct rustpython_vm::obj::objint::PyInt

pub struct PyInt { /* fields omitted */ }

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

Methods

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]

Trait Implementations

impl Debug for PyInt[src]

impl Display for PyInt[src]

impl PyClassDef for PyInt[src]

impl PyClassImpl for PyInt[src]

impl PyValue for PyInt[src]

Auto Trait Implementations

impl RefUnwindSafe for PyInt

impl Send for PyInt

impl Sync for PyInt

impl Unpin for PyInt

impl UnwindSafe for PyInt

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

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

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

impl<T> PyObjectPayload for T where
    T: 'static + PyValue
[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]

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>,