Struct sanitizer::IntSanitizer[][src]

pub struct IntSanitizer<T: PartialOrd + Copy>(_);
Expand description

The IntSanitizer structure is a wrapper over a type T which is to be sanitized, T can be anything that’s PartialOrd

Example

use sanitizer::prelude::*;

let mut instance = IntSanitizer::from(5);
instance
	.clamp(9, 15);
assert_eq!(instance.get(), 9);

Implementations

Consume the struct and return T

Sets the int equal to the max value if it exceds the provided max value provided in the function argument

Call a custom function for sanitizing the value of type T

Trait Implementations

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.