## Signature
```rust theme={null}
pub extern fn u256_sqrt(a: u256) -> u128 implicits(RangeCheck) nopanic;
```
# core::integer::u256_wide_mul
Source: https://docs.starknet.io/build/corelib/core-integer-u256_wide_mul
## Signature
```rust theme={null}
pub fn u256_wide_mul(a: u256, b: u256) -> u512
```
# core::integer::u32
Source: https://docs.starknet.io/build/corelib/core-integer-u32
The 32-bit unsigned integer type.
## Signature
```rust theme={null}
pub extern type u32;
```
# core::integer::u32_overflowing_add
Source: https://docs.starknet.io/build/corelib/core-integer-u32_overflowing_add
## Signature
```rust theme={null}
pub extern fn u32_overflowing_add(lhs: u32, rhs: u32) -> Result implicits(RangeCheck) nopanic;
```
# core::integer::u32_overflowing_sub
Source: https://docs.starknet.io/build/corelib/core-integer-u32_overflowing_sub
## Signature
```rust theme={null}
pub extern fn u32_overflowing_sub(lhs: u32, rhs: u32) -> Result implicits(RangeCheck) nopanic;
```
# core::integer::u32_safe_divmod
Source: https://docs.starknet.io/build/corelib/core-integer-u32_safe_divmod
## Signature
```rust theme={null}
pub extern fn u32_safe_divmod(lhs: u32, rhs: NonZero) -> (u32, u32) implicits(RangeCheck) nopanic;
```
# core::integer::u32_sqrt
Source: https://docs.starknet.io/build/corelib/core-integer-u32_sqrt
## Signature
```rust theme={null}
pub extern fn u32_sqrt(value: u32) -> u16 implicits(RangeCheck) nopanic;
```
# core::integer::u32_wide_mul
Source: https://docs.starknet.io/build/corelib/core-integer-u32_wide_mul
## Signature
```rust theme={null}
pub extern fn u32_wide_mul(lhs: u32, rhs: u32) -> u64 nopanic;
```
# core::integer::u32_wrapping_add
Source: https://docs.starknet.io/build/corelib/core-integer-u32_wrapping_add
## Signature
```rust theme={null}
pub fn u32_wrapping_add(lhs: u32, rhs: u32) -> u32
```
# core::integer::u32_wrapping_sub
Source: https://docs.starknet.io/build/corelib/core-integer-u32_wrapping_sub
## Signature
```rust theme={null}
pub fn u32_wrapping_sub(lhs: u32, rhs: u32) -> u32
```
# core::integer::u512
Source: https://docs.starknet.io/build/corelib/core-integer-u512
## Signature
```rust theme={null}
#[derive(Copy, Drop, Hash, PartialEq, Serde)]
pub struct u512 {
pub limb0: u128,
pub limb1: u128,
pub limb2: u128,
pub limb3: u128,
}
```
## Members
### limb0
#### Signature
```rust theme={null}
pub limb0: u128
```
### limb1
#### Signature
```rust theme={null}
pub limb1: u128
```
### limb2
#### Signature
```rust theme={null}
pub limb2: u128
```
### limb3
#### Signature
```rust theme={null}
pub limb3: u128
```
# core::integer::u512_safe_div_rem_by_u256
Source: https://docs.starknet.io/build/corelib/core-integer-u512_safe_div_rem_by_u256
Calculates division with remainder of a u512 by a non-zero u256.
## Signature
```rust theme={null}
pub fn u512_safe_div_rem_by_u256(lhs: u512, rhs: NonZero) -> (u512, u256)
```
# core::integer::u64
Source: https://docs.starknet.io/build/corelib/core-integer-u64
The 64-bit unsigned integer type.
## Signature
```rust theme={null}
pub extern type u64;
```
# core::integer::u64_overflowing_add
Source: https://docs.starknet.io/build/corelib/core-integer-u64_overflowing_add
## Signature
```rust theme={null}
pub extern fn u64_overflowing_add(lhs: u64, rhs: u64) -> Result implicits(RangeCheck) nopanic;
```
# core::integer::u64_overflowing_sub
Source: https://docs.starknet.io/build/corelib/core-integer-u64_overflowing_sub
## Signature
```rust theme={null}
pub extern fn u64_overflowing_sub(lhs: u64, rhs: u64) -> Result implicits(RangeCheck) nopanic;
```
# core::integer::u64_safe_divmod
Source: https://docs.starknet.io/build/corelib/core-integer-u64_safe_divmod
## Signature
```rust theme={null}
pub extern fn u64_safe_divmod(lhs: u64, rhs: NonZero) -> (u64, u64) implicits(RangeCheck) nopanic;
```
# core::integer::u64_sqrt
Source: https://docs.starknet.io/build/corelib/core-integer-u64_sqrt
## Signature
```rust theme={null}
pub extern fn u64_sqrt(value: u64) -> u32 implicits(RangeCheck) nopanic;
```
# core::integer::u64_wide_mul
Source: https://docs.starknet.io/build/corelib/core-integer-u64_wide_mul
## Signature
```rust theme={null}
pub extern fn u64_wide_mul(lhs: u64, rhs: u64) -> u128 nopanic;
```
# core::integer::u64_wrapping_add
Source: https://docs.starknet.io/build/corelib/core-integer-u64_wrapping_add
## Signature
```rust theme={null}
pub fn u64_wrapping_add(lhs: u64, rhs: u64) -> u64
```
# core::integer::u64_wrapping_sub
Source: https://docs.starknet.io/build/corelib/core-integer-u64_wrapping_sub
## Signature
```rust theme={null}
pub fn u64_wrapping_sub(lhs: u64, rhs: u64) -> u64
```
# core::integer::u8
Source: https://docs.starknet.io/build/corelib/core-integer-u8
The 8-bit unsigned integer type.
## Signature
```rust theme={null}
pub extern type u8;
```
# core::integer::u8_overflowing_add
Source: https://docs.starknet.io/build/corelib/core-integer-u8_overflowing_add
## Signature
```rust theme={null}
pub extern fn u8_overflowing_add(lhs: u8, rhs: u8) -> Result implicits(RangeCheck) nopanic;
```
# core::integer::u8_overflowing_sub
Source: https://docs.starknet.io/build/corelib/core-integer-u8_overflowing_sub
## Signature
```rust theme={null}
pub extern fn u8_overflowing_sub(lhs: u8, rhs: u8) -> Result implicits(RangeCheck) nopanic;
```
# core::integer::u8_safe_divmod
Source: https://docs.starknet.io/build/corelib/core-integer-u8_safe_divmod
## Signature
```rust theme={null}
pub extern fn u8_safe_divmod(lhs: u8, rhs: NonZero) -> (u8, u8) implicits(RangeCheck) nopanic;
```
# core::integer::u8_sqrt
Source: https://docs.starknet.io/build/corelib/core-integer-u8_sqrt
## Signature
```rust theme={null}
pub extern fn u8_sqrt(value: u8) -> u8 implicits(RangeCheck) nopanic;
```
# core::integer::u8_wide_mul
Source: https://docs.starknet.io/build/corelib/core-integer-u8_wide_mul
## Signature
```rust theme={null}
pub extern fn u8_wide_mul(lhs: u8, rhs: u8) -> u16 nopanic;
```
# core::integer::u8_wrapping_add
Source: https://docs.starknet.io/build/corelib/core-integer-u8_wrapping_add
## Signature
```rust theme={null}
pub fn u8_wrapping_add(lhs: u8, rhs: u8) -> u8
```
# core::integer::u8_wrapping_sub
Source: https://docs.starknet.io/build/corelib/core-integer-u8_wrapping_sub
## Signature
```rust theme={null}
pub fn u8_wrapping_sub(lhs: u8, rhs: u8) -> u8
```
# core::internal::DestructWith
Source: https://docs.starknet.io/build/corelib/core-internal-DestructWith
Wrapper type to ensure that a type `T` is destructed using a specific `Destruct` impl.
## Signature
```rust theme={null}
pub struct DestructWith> {
pub value: T,
}
```
## Members
### value
#### Signature
```rust theme={null}
pub value: T
```
# core::internal::DropWith
Source: https://docs.starknet.io/build/corelib/core-internal-DropWith
Wrapper type to ensure that a type `T` is dropped using a specific `Drop` impl.
## Signature
```rust theme={null}
pub struct DropWith> {
pub value: T,
}
```
## Members
### value
#### Signature
```rust theme={null}
pub value: T
```
# core::internal::InferDestruct
Source: https://docs.starknet.io/build/corelib/core-internal-InferDestruct
Helper to have the same interface as `DestructWith` while inferring the `Destruct`
implementation.
## Signature
```rust theme={null}
#[derive(Destruct)]
pub struct InferDestruct {
pub value: T,
}
```
## Members
### value
#### Signature
```rust theme={null}
pub value: T
```
# core::internal::InferDrop
Source: https://docs.starknet.io/build/corelib/core-internal-InferDrop
Helper to have the same interface as `DropWith` while inferring the `Drop` implementation.
## Signature
```rust theme={null}
#[derive(Drop)]
pub struct InferDrop {
pub value: T,
}
```
## Members
### value
#### Signature
```rust theme={null}
pub value: T
```
# core::internal::LoopResult
Source: https://docs.starknet.io/build/corelib/core-internal-LoopResult
The return type for loops with an early return.
## Signature
```rust theme={null}
pub enum LoopResult {
Normal: N,
EarlyReturn: E,
}
```
## Variants
### Normal
#### Signature
```rust theme={null}
Normal: N
```
### EarlyReturn
#### Signature
```rust theme={null}
EarlyReturn: E
```
# core::internal::OptionRev
Source: https://docs.starknet.io/build/corelib/core-internal-OptionRev
Same as `Option`, except that the order of the variants is reversed.
This is used as the return type of some libfuncs for efficiency reasons.
## Signature
```rust theme={null}
pub enum OptionRev {
None,
Some: T,
}
```
## Variants
### None
#### Signature
```rust theme={null}
None
```
### Some
#### Signature
```rust theme={null}
Some: T
```
# core::internal::bounded_int::AddHelper
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-AddHelper
A helper trait for adding two `BoundedInt` instances.
## Signature
```rust theme={null}
pub trait AddHelper
```
## Trait types
### Result
#### Signature
```rust theme={null}
type Result;
```
# core::internal::bounded_int::ConstrainHelper
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-ConstrainHelper
A helper trait for constraining a `BoundedInt` instance.
## Signature
```rust theme={null}
pub trait ConstrainHelper
```
## Trait types
### LowT
#### Signature
```rust theme={null}
type LowT;
```
### HighT
#### Signature
```rust theme={null}
type HighT;
```
# core::internal::bounded_int::DivRemHelper
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-DivRemHelper
A helper trait for dividing two `BoundedInt` instances.
## Signature
```rust theme={null}
pub trait DivRemHelper
```
## Trait types
### DivT
#### Signature
```rust theme={null}
type DivT;
```
### RemT
#### Signature
```rust theme={null}
type RemT;
```
# core::internal::bounded_int::MulHelper
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-MulHelper
A helper trait for multiplying two `BoundedInt` instances.
## Signature
```rust theme={null}
pub trait MulHelper
```
## Trait types
### Result
#### Signature
```rust theme={null}
type Result;
```
# core::internal::bounded_int::NegateHelper
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-NegateHelper
A helper trait for negating a `BoundedInt` instance.
## Signature
```rust theme={null}
pub trait NegateHelper
```
## Trait functions
### negate
Negates the given value.
#### Signature
```rust theme={null}
fn negate(self: T) -> NegateHelperResult
```
## Trait types
### Result
The result of negating the given value.
#### Signature
```rust theme={null}
type Result;
```
# core::internal::bounded_int::SubHelper
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-SubHelper
A helper trait for subtracting two `BoundedInt` instances.
## Signature
```rust theme={null}
pub trait SubHelper
```
## Trait types
### Result
#### Signature
```rust theme={null}
type Result;
```
# core::internal::bounded_int::TrimMaxHelper
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-TrimMaxHelper
A helper trait for trimming a `BoundedInt` instance max value.
## Signature
```rust theme={null}
pub trait TrimMaxHelper
```
## Trait types
### Target
#### Signature
```rust theme={null}
type Target;
```
# core::internal::bounded_int::TrimMinHelper
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-TrimMinHelper
A helper trait for trimming a `BoundedInt` instance min value.
## Signature
```rust theme={null}
pub trait TrimMinHelper
```
## Trait types
### Target
#### Signature
```rust theme={null}
type Target;
```
# core::internal::bounded_int::UnitInt
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-UnitInt
## Signature
```rust theme={null}
pub type UnitInt = BoundedInt;
```
# core::internal::bounded_int::bounded_int_add
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-bounded_int_add
## Signature
```rust theme={null}
extern fn bounded_int_add(lhs: Lhs, rhs: Rhs) -> Result nopanic;
```
# core::internal::bounded_int::bounded_int_constrain
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-bounded_int_constrain
## Signature
```rust theme={null}
extern fn bounded_int_constrain(value: T) -> Result implicits(RangeCheck) nopanic;
```
# core::internal::bounded_int::bounded_int_div_rem
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-bounded_int_div_rem
## Signature
```rust theme={null}
extern fn bounded_int_div_rem(lhs: Lhs, rhs: NonZero) -> (DivT, RemT) implicits(RangeCheck) nopanic;
```
# core::internal::bounded_int::bounded_int_is_zero
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-bounded_int_is_zero
## Signature
```rust theme={null}
extern fn bounded_int_is_zero(value: T) -> IsZeroResult nopanic;
```
# core::internal::bounded_int::bounded_int_mul
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-bounded_int_mul
## Signature
```rust theme={null}
extern fn bounded_int_mul(lhs: Lhs, rhs: Rhs) -> Result nopanic;
```
# core::internal::bounded_int::bounded_int_sub
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-bounded_int_sub
## Signature
```rust theme={null}
extern fn bounded_int_sub(lhs: Lhs, rhs: Rhs) -> Result nopanic;
```
# core::internal::bounded_int::bounded_int_trim_max
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-bounded_int_trim_max
## Signature
```rust theme={null}
extern fn bounded_int_trim_max(value: T) -> OptionRev nopanic;
```
# core::internal::bounded_int::bounded_int_trim_min
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-bounded_int_trim_min
## Signature
```rust theme={null}
extern fn bounded_int_trim_min(value: T) -> OptionRev nopanic;
```
# core::internal::bounded_int::downcast
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-downcast
Downcasts `FromType` to `ToType` - for types where conversion may fail.
If done for wrong types would cause a compiler panic at the Sierra stage.
## Signature
```rust theme={null}
pub extern fn downcast(x: FromType) -> Option implicits(RangeCheck) nopanic;
```
# core::internal::bounded_int::upcast
Source: https://docs.starknet.io/build/corelib/core-internal-bounded_int-upcast
Upcasts `FromType` to `ToType` - for types where conversion is always legal.
If done for wrong types would cause a compiler panic at the Sierra stage.
## Signature
```rust theme={null}
pub extern fn upcast(x: FromType) -> ToType nopanic;
```
# core::internal::require_implicit
Source: https://docs.starknet.io/build/corelib/core-internal-require_implicit
Function to enforce that `Implicit` is used by a function calling it.
Note: This extern function is not mapped to a Sierra function, and all usages of it are removed
during compilation.
## Signature
```rust theme={null}
pub extern fn require_implicit() implicits(Implicit) nopanic;
```
# core::internal::revoke_ap_tracking
Source: https://docs.starknet.io/build/corelib/core-internal-revoke_ap_tracking
## Signature
```rust theme={null}
pub extern fn revoke_ap_tracking() nopanic;
```
# core::iter::adapters::peekable::PeekableTrait
Source: https://docs.starknet.io/build/corelib/core-iter-adapters-peekable-PeekableTrait
## Signature
```rust theme={null}
pub trait PeekableTrait+Copy+Drop>
```
## Trait functions
### peek
Returns a copy of the next() value without advancing the iterator.
Like `next`, if there is a value, it is wrapped in a `Some(T)`.
But if the iteration is over, `None` is returned.
#### Signature
```rust theme={null}
fn peek,
+Copy,
+Drop,
I,
impl IterI: Iterator,
+Copy,
+Drop,
>(
ref self: Peekable,
) -> Option
```
#### Examples
Basic usage:
```rust theme={null}
let mut iter = (1..4_u8).into_iter().peekable();
// peek() lets us see one step into the future
assert_eq!(iter.peek(), Some(1));
assert_eq!(iter.next(), Some(1));
assert_eq!(iter.next(), Some(2));
// The iterator does not advance even if we `peek` multiple times
assert_eq!(iter.peek(), Some(3));
assert_eq!(iter.peek(), Some(3));
assert_eq!(iter.next(), Some(3));
// After the iterator is finished, so is `peek()`
assert_eq!(iter.peek(), None);
assert_eq!(iter.next(), None);
```
# core::iter::adapters::zip::zip
Source: https://docs.starknet.io/build/corelib/core-iter-adapters-zip-zip
Converts the arguments to iterators and zips them.
See the documentation of `Iterator::zip` for more.
## Signature
```rust theme={null}
pub fn zip,
impl BIntoIter: IntoIterator,
+Destruct,
+Destruct,
>(
a: A, b: B,
) -> Zip
```
## Examples
```rust theme={null}
use std::iter::zip;
let xs = array![1, 2, 3];
let ys = array![4, 5, 6];
let mut iter = zip(xs, ys);
assert_eq!(iter.next().unwrap(), (1, 4));
assert_eq!(iter.next().unwrap(), (2, 5));
assert_eq!(iter.next().unwrap(), (3, 6));
assert!(iter.next().is_none());
```
# core::iter::traits::collect::Extend
Source: https://docs.starknet.io/build/corelib/core-iter-traits-collect-Extend
Extend a collection with the contents of an iterator.
Iterators produce a series of values, and collections can also be thought
of as a series of values. The `Extend` trait bridges this gap, allowing you
to extend a collection by including the contents of that iterator. When
extending a collection with an already existing key, that entry is updated
or, in the case of collections that permit multiple entries with equal
keys, that entry is inserted.
## Signature
```rust theme={null}
pub trait Extend
```
## Examples
Basic usage:
```rust theme={null}
let mut arr = array![1, 2];
arr.extend(array![3, 4, 5]);
assert_eq!(arr, array![1, 2, 3, 4, 5]);
```
## Trait functions
### extend
Extends a collection with the contents of an iterator.
#### Signature
```rust theme={null}
fn extend,
+TypeEqual,
+Destruct,
+Destruct,
>(
ref self: T, iter: I,
)
```
# core::iter::traits::collect::FromIterator
Source: https://docs.starknet.io/build/corelib/core-iter-traits-collect-FromIterator
Conversion from an [`Iterator`](./core-iter-traits-iterator-Iterator).
By implementing `FromIterator` for a type, you define how it will be
created from an iterator. This is common for types which describe a
collection of some kind.
If you want to create a collection from the contents of an iterator, the
`Iterator::collect()` method is preferred. However, when you need to
specify the container type, `FromIterator::from_iter()` can be more
readable than using a turbofish (e.g. `::>()`). See the
`Iterator::collect()` documentation for more examples of its use.
See also: [`IntoIterator`](./core-iter-traits-collect-IntoIterator).
## Signature
```rust theme={null}
pub trait FromIterator
```
## Examples
Basic usage:
```rust theme={null}
let v = FromIterator::from_iter(0..5_u32);
assert_eq!(v, array![0, 1, 2, 3, 4]);
```
Implementing `FromIterator` for your type:
```rust theme={null}
use core::metaprogramming::TypeEqual;
// A sample collection, that's just a wrapper over Array
#[derive(Drop, Debug)]
struct MyCollection {
arr: Array,
}
// Let's give it some methods so we can create one and add things
// to it.
#[generate_trait]
impl MyCollectionImpl of MyCollectionTrait {
fn new() -> MyCollection {
MyCollection { arr: ArrayTrait::new() }
}
fn add(ref self: MyCollection, elem: u32) {
self.arr.append(elem);
}
}
// and we'll implement FromIterator
impl MyCollectionFromIterator of FromIterator {
fn from_iter,
+TypeEqual,
+Destruct,
+Destruct,
>(
iter: I
) -> MyCollection {
let mut c = MyCollectionTrait::new();
for i in iter {
c.add(i);
};
c
}
}
// Now we can make a new iterator...
let iter = (0..5_u32).into_iter();
// ... and make a MyCollection out of it
let c = FromIterator::::from_iter(iter);
assert_eq!(c.arr, array![0, 1, 2, 3, 4]);
```
## Trait functions
### from\_iter
Creates a value from an iterator.
Se프로젝트로 돌아가기