pub trait WithOffset<O> {
type Output;
// Required method
fn with_offset(&self, offset: O) -> Self::Output;
}Expand description
Functionality to add an offset to a value and convert it.
§Examples
use offset_views::with_offset::WithOffset;
assert_eq!(3.with_offset(5), 8);
assert_eq!((3..8).with_offset(-3), 0..5);Required Associated Types§
Required Methods§
Sourcefn with_offset(&self, offset: O) -> Self::Output
fn with_offset(&self, offset: O) -> Self::Output
Adds an offset to a value and tries to convert the result to a suitable output type.
This method may panic if it is not possible to represent the result in the output type.