Implement the `IntoIterator` trait for the `RomanNumber` type to enable using a for loop notation. This implementation must allow taking ownership, borrowing and borrowing mutably.
Implement the `Iterator` trait for the `RomanNumber` type. You should use the code from the previous exercise roman_numbers.
1. Taking ownership (this consumes the RomanNumber)
```rust
for digit in number {
...
}
```
2. Borrowing immutably (this preserves the RomanNumber)
```rust
for digit in &number {
}
```
3. Borrowing mutably (this allow you to modify the RomanNumber without having to return the ownership)
Write a **program** which takes a `string` which contains an equation written in `Reverse Polish Notation` (RPN) as its first argument,
Write a **program** which takes a `string` that contains an equation written in `Reverse Polish Notation` (RPN) as an argument. The **program** must evaluate the equation, and then:
which evaluates the equation, and which prints the result on the standard output followed by a newline (`'\n'`).
`Reverse Polish Notation` is a mathematical notation in which every operator follows all of its operands. In RPN,
- If the `string` is not valid or if there is not exactly one argument, `Error` must be printed on the standard output followed by a newline.
every operator encountered evaluates the previous 2 operands, and the result of this operation then becomes the first of
- If the `string` has extra spaces it is still considered valid.
the two operands for the subsequent operator. Operands and operators must be spaced by at least one space.
The following operators must be implemented : `+`, `-`, `*`, `/`, and `%`.
`Reverse Polish Notation` is a mathematical notation in which every operator follows all of its operands. In RPN, every operator encountered evaluates the previous 2 operands, and the result of this operation then becomes the first of the two operands for the subsequent operator. Operands and operators must be spaced by at least one space.
If the `string` is not valid or if there is not exactly one argument, `Error` must be printed on the standard output followed by a newline.
The following operators must be implemented : `+`, `-`, `*`, `/`, and `%`.
If the `string` has extra spaces it is still considered valid.
All the given operands must fit in a `i64`.
All the given operands must fit in a `i64`.
@ -55,7 +52,7 @@ For receiving arguments from the command line you should use something like: