Trait Enlarge

Source
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§

Source

fn enlarge_with(&self, alpha: T) -> Self::Output

Implementations on Foreign Types§

Source§

impl Enlarge<i32> for i32

Source§

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: The alpha parameter in the enlarge_with function represents the amount by which the interval should be enlarged. It is an i32 type, which means it is an integer value.

Returns:

An Interval<i32> struct is being returned.

Source§

type Output = Interval<i32>

Implementors§

Source§

impl<T> Enlarge<T> for Interval<T>
where T: Copy + Add<Output = T> + Sub<Output = T>,