//! > Hover
//! > test_runner_name
test_hover
//! > cairo_project.toml
[crate_roots]
hello = "src"
[config.global]
edition = "2023_11"
//! > cairo_code
fn main() {
let mut x<caret> = 5;
p<caret>rintln!("The value of x is: {}", x);
x<caret> = <caret>a<caret>dd_two<caret>(x);
front<caret>_of_house::ho<caret>sting::add<caret>_to_waitlist();
let mut re<caret>ct = Rect<caret>angle { wid<caret>th: 30, height: 50 };
let ar<caret>ea = rect.ar<caret>ea();
}
/// `add_two` documentation.
fn add_t<caret>wo(x: u32) -> u32 {
//! Adds 2 to an unsigned argument.
x + 2
}
/// Rectangle struct.
#[derive(Copy, Drop)]
struct Rectangle {
/// Width of the rectangle.
width: u64,
/// Height of the rectangle.
height: u64,
}
/// Rectangle trait.
trait RectangleTrait {
/// Calculate the area of the rectangle.
fn area(sel<caret>f: @Rec<caret>tangle) -> u64;
}
/// Implementing the `RectangleTrait` for the `Rectangle` struct.
impl RectangleImpl of RectangleTrait {
fn area(se<caret>lf: @Rec<caret>tangle) -> u64 {
(*self<caret>.<caret>wi<caret>dth) * (*sel<caret>f.he<caret>ight)
}
}
/// Testing `#[generate_trait]` attribute.
#[generate_trait]
impl RectangleImpl2 of RectangleTrait2 {
/// Calculate the area of the rectangle #2.
fn area2(self: @Rec<caret>tangle) -> u64 {
(*self.wi<caret>dth) * (*self.height)
}
}
enum Co<caret>in {
Pen<caret>ny,
}
fn value_i<caret>n_cents(co<caret>in: C<caret>oin) -> felt252 {
match co<caret>in {
Coin::P<caret>enny => 1,
}
}
/// Front of house module.
pub mod front_of_house {
/// Hosting module.
pub mod hosting {
/// Add to waitlist function.
pub fn add_to_waitlist() {}
}
}
//! > hover #0
// = source context
let mut x<caret> = 5;
// = highlight
No highlight information.
// = popover
Type: `core::integer::u32`
//! > hover #1
// = source context
p<caret>rintln!("The value of x is: {}", x);
// = highlight
<sel>println</sel>!("The value of x is: {}", x);
// = popover
```cairo
println
```
---
Prints to the standard output, with a newline.
This macro uses the same syntax as `format!`, but writes to the standard output instead.
# Panics
Panics if any of the formatting of arguments fails.
# Examples
```cairo
println!(); // Prints an empty line.
println!(\"hello\"); // Prints "hello".
let world: ByteArray = "world";
println!("hello {}", world_ba); // Prints "hello world".
println!("hello {world_ba}"); // Prints "hello world".
```
//! > hover #2
// = source context
x<caret> = add_two(x);
// = highlight
<sel>x</sel> = add_two(x);
// = popover
```cairo
let mut x: core::integer::u32
```
//! > hover #3
// = source context
x = <caret>add_two(x);
// = highlight
x = <sel>add_two</sel>(x);
// = popover
```cairo
hello
```
```cairo
fn add_two(x: u32) -> u32
```
---
`add_two` documentation. Adds 2 to an unsigned argument.
//! > hover #4
// = source context
x = a<caret>dd_two(x);
// = highlight
x = <sel>add_two</sel>(x);
// = popover
```cairo
hello
```
```cairo
fn add_two(x: u32) -> u32
```
---
`add_two` documentation. Adds 2 to an unsigned argument.
//! > hover #5
// = source context
x = add_two<caret>(x);
// = highlight
x = <sel>add_two</sel>(x);
// = popover
```cairo
hello
```
```cairo
fn add_two(x: u32) -> u32
```
---
`add_two` documentation. Adds 2 to an unsigned argument.
//! > hover #6
// = source context
front<caret>_of_house::hosting::add_to_waitlist();
// = highlight
<sel>front_of_house</sel>::hosting::add_to_waitlist();
// = popover
```cairo
hello
```
```cairo
mod front_of_house
```
---
Front of house module.
//! > hover #7
// = source context
front_of_house::ho<caret>sting::add_to_waitlist();
// = highlight
front_of_house::<sel>hosting</sel>::add_to_waitlist();
// = popover
```cairo
hello::front_of_house
```
```cairo
mod hosting
```
---
Hosting module.
//! > hover #8
// = source context
front_of_house::hosting::add<caret>_to_waitlist();
// = highlight
front_of_house::hosting::<sel>add_to_waitlist</sel>();
// = popover
```cairo
hello::front_of_house::hosting
```
```cairo
pub fn add_to_waitlist()
```
---
Add to waitlist function.
//! > hover #9
// = source context
let mut re<caret>ct = Rectangle { width: 30, height: 50 };
// = highlight
No highlight information.
// = popover
Type: `hello::Rectangle`
//! > hover #10
// = source context
let mut rect = Rect<caret>angle { width: 30, height: 50 };
// = highlight
let mut rect = <sel>Rectangle</sel> { width: 30, height: 50 };
// = popover
```cairo
hello
```
```cairo
#[derive(Copy, Drop)]
struct Rectangle {
width: u64,
height: u64,
}
```
---
Rectangle struct.
//! > hover #11
// = source context
let mut rect = Rectangle { wid<caret>th: 30, height: 50 };
// = highlight
let mut rect = Rectangle { <sel>width</sel>: 30, height: 50 };
// = popover
```cairo
hello
```
```cairo
#[derive(Copy, Drop)]
struct Rectangle {
width: u64,
height: u64,
}
```
---
Width of the rectangle.
//! > hover #12
// = source context
let ar<caret>ea = rect.area();
// = highlight
No highlight information.
// = popover
Type: `core::integer::u64`
//! > hover #13
// = source context
let area = rect.ar<caret>ea();
// = highlight
let area = rect.<sel>area</sel>();
// = popover
```cairo
hello::RectangleTrait
```
```cairo
trait RectangleTrait
fn area(self: @Rectangle) -> u64
```
---
Calculate the area of the rectangle.
//! > hover #14
// = source context
fn add_t<caret>wo(x: u32) -> u32 {
// = highlight
fn <sel>add_two</sel>(x: u32) -> u32 {
// = popover
```cairo
hello
```
```cairo
fn add_two(x: u32) -> u32
```
---
`add_two` documentation. Adds 2 to an unsigned argument.
//! > hover #15
// = source context
fn area(sel<caret>f: @Rectangle) -> u64;
// = highlight
fn area(<sel>self</sel>: @Rectangle) -> u64;
// = popover
```cairo
hello::RectangleTrait
```
```cairo
trait RectangleTrait
fn area(self: @Rectangle) -> u64
```
---
Calculate the area of the rectangle.
//! > hover #16
// = source context
fn area(self: @Rec<caret>tangle) -> u64;
// = highlight
fn area(self: @<sel>Rectangle</sel>) -> u64;
// = popover
```cairo
hello
```
```cairo
#[derive(Copy, Drop)]
struct Rectangle {
width: u64,
height: u64,
}
```
---
Rectangle struct.
//! > hover #17
// = source context
fn area(se<caret>lf: @Rectangle) -> u64 {
// = highlight
fn area(<sel>self</sel>: @Rectangle) -> u64 {
// = popover
```cairo
hello
```
```cairo
impl RectangleImpl of RectangleTrait
```
---
Implementing the `RectangleTrait` for the `Rectangle` struct.
//! > hover #18
// = source context
fn area(self: @Rec<caret>tangle) -> u64 {
// = highlight
fn area(self: @<sel>Rectangle</sel>) -> u64 {
// = popover
```cairo
hello
```
```cairo
#[derive(Copy, Drop)]
struct Rectangle {
width: u64,
height: u64,
}
```
---
Rectangle struct.
//! > hover #19
// = source context
(*self<caret>.width) * (*self.height)
// = highlight
(*<sel>self</sel>.width) * (*self.height)
// = popover
```cairo
self: @hello::Rectangle
```
//! > hover #20
// = source context
(*self.<caret>width) * (*self.height)
// = highlight
(*self.<sel>width</sel>) * (*self.height)
// = popover
```cairo
hello
```
```cairo
#[derive(Copy, Drop)]
struct Rectangle {
width: u64,
height: u64,
}
```
---
Width of the rectangle.
//! > hover #21
// = source context
(*self.wi<caret>dth) * (*self.height)
// = highlight
(*self.<sel>width</sel>) * (*self.height)
// = popover
```cairo
hello
```
```cairo
#[derive(Copy, Drop)]
struct Rectangle {
width: u64,
height: u64,
}
```
---
Width of the rectangle.
//! > hover #22
// = source context
(*self.width) * (*sel<caret>f.height)
// = highlight
(*self.width) * (*<sel>self</sel>.height)
// = popover
```cairo
self: @hello::Rectangle
```
//! > hover #23
// = source context
(*self.width) * (*self.he<caret>ight)
// = highlight
(*self.width) * (*self.<sel>height</sel>)
// = popover
```cairo
hello
```
```cairo
#[derive(Copy, Drop)]
struct Rectangle {
width: u64,
height: u64,
}
```
---
Height of the rectangle.
//! > hover #24
// = source context
fn area2(self: @Rec<caret>tangle) -> u64 {
// = highlight
fn area2(self: @<sel>Rectangle</sel>) -> u64 {
// = popover
```cairo
hello
```
```cairo
#[derive(Copy, Drop)]
struct Rectangle {
width: u64,
height: u64,
}
```
---
Rectangle struct.
//! > hover #25
// = source context
(*self.wi<caret>dth) * (*self.height)
// = highlight
(*self.<sel>width</sel>) * (*self.height)
// = popover
```cairo
hello
```
```cairo
#[derive(Copy, Drop)]
struct Rectangle {
width: u64,
height: u64,
}
```
---
Width of the rectangle.
//! > hover #26
// = source context
enum Co<caret>in {
// = highlight
enum <sel>Coin</sel> {
// = popover
```cairo
hello
```
```cairo
enum Coin {
Penny,
}
```
//! > hover #27
// = source context
Pen<caret>ny,
// = highlight
<sel>Penny</sel>,
// = popover
```cairo
hello
```
```cairo
enum Coin {
Penny,
}
```
//! > hover #28
// = source context
fn value_i<caret>n_cents(coin: Coin) -> felt252 {
// = highlight
fn <sel>value_in_cents</sel>(coin: Coin) -> felt252 {
// = popover
```cairo
hello
```
```cairo
fn value_in_cents(coin: Coin) -> felt252
```
//! > hover #29
// = source context
fn value_in_cents(co<caret>in: Coin) -> felt252 {
// = highlight
fn value_in_cents(<sel>coin</sel>: Coin) -> felt252 {
// = popover
```cairo
hello
```
```cairo
fn value_in_cents(coin: Coin) -> felt252
```
//! > hover #30
// = source context
fn value_in_cents(coin: C<caret>oin) -> felt252 {
// = highlight
fn value_in_cents(coin: <sel>Coin</sel>) -> felt252 {
// = popover
```cairo
hello
```
```cairo
enum Coin {
Penny,
}
```
//! > hover #31
// = source context
match co<caret>in {
// = highlight
match <sel>coin</sel> {
// = popover
```cairo
coin: hello::Coin
```
//! > hover #32
// = source context
Coin::P<caret>enny => 1,
// = highlight
Coin::<sel>Penny</sel> => 1,
// = popover
```cairo
hello
```
```cairo
enum Coin {
Penny,
}
```