pub struct Integer {
pub bits: i64,
pub unsigned: bool,
}Expand description
An integer of bits bits, signed or unsigned.
PHP: Integer’s $bits and $unsigned.
Fields§
§bits: i64The size in bits.
unsigned: boolWhether the range starts at 0.
Implementations§
Source§impl Integer
impl Integer
Sourcepub fn new(bits: i64, unsigned: bool) -> Result<Self, IntegerError>
pub fn new(bits: i64, unsigned: bool) -> Result<Self, IntegerError>
The constructor’s checks of $bits and $unsigned (on a 64-bit build, the third,
that the size fits the build’s integers, follows from the first two).
PHP: new Integer($loose, $bits, $unsigned).
Sourcepub fn max(self) -> i64
pub fn max(self) -> i64
The largest valid value.
PHP: getMax() (private): (1 << $bits) - 1 unsigned, PHP_INT_MAX >> (64 - $bits)
signed.
Sourcepub fn accepts(self, loose: bool, value: Input<'_>) -> bool
pub fn accepts(self, loose: bool, value: Input<'_>) -> bool
An int within the bounds; when loose, also a numeric string that + 0 makes one.
A float is never valid, 1.0 included.
PHP: Integer::isValid().
Sourcepub fn description(self, out: &mut Vec<u8>)
pub fn description(self, out: &mut Vec<u8>)
Value must be a valid signed 32-bit integer between -2,147,483,648 and 2,147,483,647.
PHP: Integer::getDescription().
Appended to out.
Trait Implementations§
impl Copy for Integer
impl Eq for Integer
impl StructuralPartialEq for Integer
Auto Trait Implementations§
impl Forget for Integer
impl Freeze for Integer
impl Move for Integer
impl RefUnwindSafe for Integer
impl Send for Integer
impl Sync for Integer
impl Unpin for Integer
impl UnsafeUnpin for Integer
impl UnwindSafe for Integer
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.