Skip to main content

SanitizeWith

Trait SanitizeWith 

Source
pub trait SanitizeWith<Insecure, Trusted> {
    // Required method
    fn sanitize_with<Sanitizer, Error>(
        self,
        sanitizer: Sanitizer,
    ) -> Result<Trusted, Error>
       where Sanitizer: FnOnce(Insecure) -> Result<Trusted, Error>;
}
Expand description

This type can be sanitized using a provided sanitizer.

This trait will be implemented automatically for structs generated by the #[derive(UntrustedVariant)] macro.

The sanitize_with function SHOULD clear all taint from the input.

Required Methods§

Source

fn sanitize_with<Sanitizer, Error>( self, sanitizer: Sanitizer, ) -> Result<Trusted, Error>
where Sanitizer: FnOnce(Insecure) -> Result<Trusted, Error>,

Sanitizes the value using the provided sanitizer.

§Errors

If sanitization fails, an error must be returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Insecure, Trusted> SanitizeWith<Insecure, Trusted> for MaybeUntrusted<Insecure, Trusted>

Source§

impl<Insecure, Trusted> SanitizeWith<Insecure, Trusted> for UntrustedValue<Insecure>

Taint can be cleared from the value by using a sanitizer. Effectively unpacking the value; passing it to the sanitizer and returning the result.