Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.starknet.io/llms.txt

Use this file to discover all available pages before exploring further.

A trait for a type that can be squared to produce a wider type. This trait enables squaring operations where the result type has double the bit width of the input type, preventing overflow in cases where the result would exceed the input type’s maximum value.

Signature

pub trait WideSquare

Examples

use core::num::traits::WideSquare;

let a: u8 = 16;
let result: u16 = a.wide_square();
assert!(result == 256);

Trait functions

wide_square

Calculates the square, producing a wider type.

Signature

fn wide_square(self: T) -> WideSquareTarget

Trait types

Target

The type of the result of the square.

Signature

type Target;