pub trait Enlarge<T: ?Sized> {
type Output;
// Required method
fn enlarge_with(&self, alpha: T) -> Self::Output;
}Expand description
The above code is defining a trait named Enlarge in Rust. This trait has an associated type
Output and a method enlarge_with that takes a reference to self and a parameter alpha of
type T. The method returns an object of type Output. This trait can be implemented for types to
provide the functionality of enlarging or modifying the object with the provided alpha value.
Required Associated Types§
Required Methods§
fn enlarge_with(&self, alpha: T) -> Self::Output
Implementations on Foreign Types§
Source§impl Enlarge<i32> for i32
impl Enlarge<i32> for i32
Source§fn enlarge_with(&self, alpha: i32) -> Interval<i32>
fn enlarge_with(&self, alpha: i32) -> Interval<i32>
The enlarge_with function takes an integer alpha and returns an Interval struct with lower
bound as self - alpha and upper bound as self + alpha.
Arguments:
alpha: Thealphaparameter in theenlarge_withfunction represents the amount by which the interval should be enlarged. It is ani32type, which means it is an integer value.
Returns:
An Interval<i32> struct is being returned.