You can use an integer suffix on one of the literals you’ve used in the range. Type inference will do the rest:
for i in 1i64..101 {
println!("{}", i);
}
More Related Contents:
- Traits and Rust
- Why do try!() and ? not compile when used in a function that doesn’t return Option or Result?
- How do I collect into an array?
- Can I do type introspection with trait objects and then downcast it?
- Cannot borrow as mutable more than once at a time in one code – but can in another very similar
- How can I perform parallel asynchronous HTTP GET requests with reqwest?
- Is it considered a bad practice to implement Deref for newtypes?
- Implementing a trait for multiple types at once
- How do I get an owned value out of a `Box`?
- Converting from Option to Option
- Why does my variable not live long enough?
- How to iterate over and filter an array?
- If BufReader takes ownership of a stream, how can I read and write lines on it?
- Why can’t I return an &str value generated from a String?
- How to fix lifetime error when function returns a serde Deserialize type?
- Why are recursive struct types illegal in Rust?
- Understanding Traits and Object Safety
- How can I create enums with constant values in Rust?
- How to embed resources in Rust executable?
- Sized is not implemented for the type Fn
- Extend lifetime of variable
- Can’t implement a trait I don’t own for all types that implement a trait I do own
- How do I specify that a struct field must implement a trait?
- How do I print an integer in binary with leading zeros?
- How to create and write to memory mapped files?
- How does Rust’s type inference work across multiple statements?
- Downcast traits inside Rc for AST manipulation
- How to check in Rust if architecture is 32 or 64 bit?
- Is there any way to restrict a generic type to one of several types?
- How to pass rustc flags to cargo?