Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Apress/beginning-rust-2e
/ functions
Functions
846 in github.com/Apress/beginning-rust-2e
⨍
Functions
846
◇
Types & classes
148
Function
main
It prints: Ok(300) Ok(210) Err("Negative argument")*/
Source Code/17-14.rs:3
Function
main
It prints: 87*/
Source Code/02-03.rs:3
Function
main
()
Source Code/09-02.rs:4
Function
main
It prints: 34.4*/
Source Code/13-05.rs:3
Function
main
It prints: 3.1622776601683795 3.1622777*/
Source Code/19-18.rs:3
Function
main
It prints: 37 41.1*/
Source Code/10-04.rs:3
Function
main
It prints: SOUTH*/
Source Code/07-12.rs:3
Function
main
It prints nothing. */
Source Code/06-21.rs:3
Function
main
ILLEGAL. The compiler prints the error message: missing lifetime specifier */
Source Code/24-11.rs:4
Function
main
ILLEGAL. The compiler prints the error message: non-exhaustive patterns: `West` and `East` not covered */
Source Code/07-10.rs:4
Function
main
It waits for input. If the user types "b", and then presses Enter, the program prints: [Hi] If the user types something else or nothing, and then pres
Source Code/20-22.rs:10
Function
main
It prints: 0 1 2 3 4 5 6 7 8 9 10 11 */
Source Code/15-02.rs:15
Function
main
It prints: €e*/
Source Code/16-02.rs:3
Function
main
It prints: 19*/
Source Code/06-18.rs:3
Function
main
It could print: Vec: 6 8 2 8 4 9 6 1 8 0. [6, 8, 2, 8, 4, 9, 6, 1, 8, 0] HashSet : 2 4 9 8 0 1 6. {2, 4, 9, 8, 0, 1, 6} BTreeSet: 0 1 2 4 6 8 9. {0, 1
Source Code/21-12.rs:6
Function
main
It prints: Ok(true) Ok(12300000.0) Err(ParseFloatError { kind: Invalid }) */
Source Code/17-19.rs:6
Function
main
It prints: 0.33333334*/
Source Code/20-14.rs:3
Function
main
It prints: 0.33333334*/
Source Code/20-11.rs:3
Function
main
ILLEGAL. The compiler prints the error message: type annotations needed */
Source Code/03-08.rs:4
Function
main
It prints: 1234*/
Source Code/07-25.rs:3
Function
main
If run with this command line in a Unix-like shell: ./main first second it prints: [./main][first][second] If run with this command line in a Wi
Source Code/17-01.rs:11
Function
main
It prints: [ ] [John Doe] [Jane Doe]*/
Source Code/18-10.rs:3
Function
main
It prints: -2.3 + 0i, -2.1 - 5.2i, -2.2 + 5.2i*/
Source Code/19-24.rs:3
Function
main
ILLEGAL. The compiler prints the error message: mismatched types with the explanation: expected `u32`, found `i32` */
Source Code/09-23.rs:6
Function
main
It prints: */
Source Code/19-01.rs:3
Function
main
It prints: 30 true*/
Source Code/18-09.rs:3
Function
main
It prints: 37 41.1*/
Source Code/10-06.rs:3
Function
main
It prints nothing. */
Source Code/24-07.rs:3
Function
main
It prints nothing. */
Source Code/24-06.rs:3
Function
main
It prints: 87.71428571428571*/
Source Code/02-06.rs:3
Function
main
ILLEGAL. The compiler prints three error messages: missing lifetime specifier missing lifetime specifier use of undeclared lifetime name `'a` */
Source Code/24-17.rs:6
Function
main
It prints: [4, 5, 6]*/
Source Code/16-19.rs:3
Function
main
It prints: (4, 6)*/
Source Code/09-24.rs:3
Function
main
It prints: My number: 140*/
Source Code/01-08.rs:3
Function
main
It prints: 5 5*/
Source Code/03-32.rs:3
Function
main
If run with this command line in a Unix-like shell: ./main first second it prints: [./main][first][second] If run with this command line in a Wi
Source Code/17-03.rs:11
Function
main
It prints: not positive*/
Source Code/04-02.rs:3
Function
main
It prints: Opening port usb4:879 Sent to usb4:879 the message 'Message 1' Opening port eth1:12000 Sent to eth1:12000 the message 'Message 2' Closing p
Source Code/20-01.rs:10
Function
main
It prints: 6 3*/
Source Code/19-23.rs:3
Function
main
ILLEGAL. The compiler prints the three error messages: the type `[{integer}]` cannot be indexed by `isize` the type `[{integer}]` cannot be indexed by
Source Code/06-10.rs:6
Function
main
Source Code/23-02.c:5
Function
main
ILLEGAL. The compiler prints the 2 error messages: `[{integer}; 3]` doesn't implement `std::fmt::Display` `Vec<{integer}>` doesn't implement `std::fmt
Source Code/05-31.rs:5
Function
main
It prints: true false */
Source Code/16-40.rs:3
Function
main
()
Source Code/20-10.rs:23
Function
main
It prints: 3.. ..12 4 4*/
Source Code/15-24.rs:3
Function
main
If launched with the name of an existing text file as command-line argument, it prints: file: filename n. of lines: N1 n. of empty lines: N2 where fi
Source Code/17-24.rs:11
Function
main
It prints: false true */
Source Code/16-39.rs:3
Function
main
ILLEGAL. The compiler prints twice the error message: explicit lifetime required in the type of `y` */
Source Code/23-22.rs:4
Function
main
ILLEGAL. The compiler prints the two error messages: mismatched types cannot add `i16` to `i8` */
Source Code/06-07.rs:5
Function
main
ILLEGAL. The compiler prints the error message: mismatched types with the explanation: expected `u16`, found `u32` */
Source Code/10-16.rs:6
Function
main
It prints: 226 130 172 195 168 101 */
Source Code/16-08.rs:3
Function
main
It prints: This is just one line */
Source Code/02-14.rs:4
Function
main
It prints: 34 + 80 = 114*/
Source Code/02-02.rs:3
Function
main
It prints: 12*/
Source Code/15-14.rs:3
Function
main
It prints: The sum is 115.19999999999999*/
Source Code/02-05.rs:3
Function
main
It prints: Error: n.20 X*/
Source Code/07-19.rs:3
Function
main
It prints: John Doe*/
Source Code/18-08.rs:3
Function
main
ILLEGAL. The compiler prints the error message: mismatched types with the explanation: expected `()`, found integer */
Source Code/06-35.rs:6
Function
main
ILLEGAL. The compiler prints the error message: `if` may be missing an `else` clause */
Source Code/04-07.rs:4
Function
main
It prints: 12 53*/
Source Code/03-03.rs:3
Function
main
It prints: ()*/
Source Code/14-09.rs:3
Function
main
It prints: 11 21 31 */
Source Code/16-25.rs:3
Function
main
It prints: 33, 22, 11, */
Source Code/10-22.rs:3
Function
main
It prints nothing. */
Source Code/10-08.rs:3
Function
main
ILLEGAL. The compiler prints the error message: cannot borrow `v` as mutable because it is also borrowed as immutable */
Source Code/23-03.rs:4
Function
main
It prints: The sum is 114*/
Source Code/02-01.rs:3
Function
main
It prints: Hello, world!*/
Source Code/14-14.rs:3
Function
main
()
Source Code/05-08.rs:4
Function
main
It prints: 80 + 34 = 114*/
Source Code/02-10.rs:3
Function
main
It prints nothing. */
Source Code/09-22.rs:3
Function
main
ILLEGAL. The compiler prints the error message: the trait bound `bool: HasSquareRoot` is not satisfied with the explanation: the trait `HasSquareRoot`
Source Code/19-07.rs:6
Function
main
It prints: 8 4*/
Source Code/09-12.rs:3
Function
main
It prints: 3.1622776601683795 3.1622777*/
Source Code/19-13.rs:3
Function
main
ILLEGAL. The compiler prints the error message: mismatched types */
Source Code/05-03.rs:4
Function
main
It prints: 3.1622776601683795 3.1622777 */
Source Code/19-02.rs:4
Function
main
It prints: 3.1622776601683795 3.1622777*/
Source Code/19-15.rs:3
Function
main
ILLEGAL. The compiler prints twice the error message: mismatched types the first one with the explanation: expected slice `[u8]`, found `str` and the
Source Code/17-17.rs:8
Function
main
It prints nothing, but it creates a file named "data.txt". */
Source Code/17-21.rs:4
Function
main
It prints: 57*/
Source Code/16-42.rs:3
Function
main
Source Code/04-19.c:4
Function
main
It could print: 5.727µs 441.749399ms 62.016521ms*/
Source Code/21-02.rs:3
Function
main
It prints: 18 35 13 12 33 27 16 50 29 42 39 17 20 48 */
Source Code/21-08.rs:3
Function
main
It prints: -1 49 4.7 7 12000 */
Source Code/09-25.rs:3
Function
main
It prints: true false*/
Source Code/03-16.rs:3
Function
main
It prints: 12*/
Source Code/15-13.rs:3
Function
main
It prints: 5 Error: "negative argument" */
Source Code/17-15.rs:5
Function
main
It prints: 10 256*/
Source Code/06-03.rs:3
Function
main
It prints nothing. */
Source Code/01-01.rs:3
Function
main
Source Code/03-04.c:4
Function
main
Source Code/08-09.c:4
Function
main
ILLEGAL. The compiler prints twice the error message: lifetime mismatch */
Source Code/23-19.rs:4
Function
main
It prints: -2 -0.19999999999999996*/
Source Code/02-09.rs:3
Function
main
It prints: 1 4 9 16 25 36 49 64 81 100 */
Source Code/04-15.rs:3
Function
main
It prints: "Hello, world!" does not contain 'R'.*/
Source Code/16-35.rs:3
Function
main
The compiler prints the warning message: variable does not need to be mutable Then, the program prints: 12 */
Source Code/03-06.rs:6
Function
main
It prints: aab*/
Source Code/09-06.rs:3
Function
main
ILLEGAL. The compiler prints three times the error message: mismatched types one with the explanation: expected `i16`, found `u16` and the others with
Source Code/10-07.rs:8
Function
main
It prints: 4.6 3.91*/
Source Code/06-16.rs:3
Function
main
It prints: 34*/
Source Code/01-13.rs:3
Function
main
It prints: 8 / 2 = 4 Cannot divide 8 by 0: Divide by zero */
Source Code/10-19.rs:5
← previous
next →
701–800 of 846, ranked by callers