Skip to main content

Answer

Trait Answer 

Source
pub trait Answer<R> {
    // Required method
    fn sample(&mut self, request: &ImageSample<R>) -> Result<[f32; 4], String>;

    // Provided methods
    fn load(&mut self, request: &ImageLoad<R>) -> Result<[u32; 4], String> { ... }
    fn query(&mut self, request: &ImageQuery<R>) -> Result<[u32; 4], String> { ... }
}
Expand description

How the caller answers a run’s texture reads (AnsweredReads), each by its request; R names the texture (a program’s resource Element, or a bind slot). A load or a query is refused unless the answer gives one, so no read is answered by a value nobody stated.

Required Methods§

Source

fn sample(&mut self, request: &ImageSample<R>) -> Result<[f32; 4], String>

Answer a sample request with the texel’s four lanes.

Provided Methods§

Source

fn load(&mut self, request: &ImageLoad<R>) -> Result<[u32; 4], String>

Answer a texel load; refused unless the answer gives one.

Source

fn query(&mut self, request: &ImageQuery<R>) -> Result<[u32; 4], String>

Answer a size or level-count query; refused unless the answer gives one.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<R, F: FnMut(&ImageSample<R>) -> Result<[f32; 4], String>> Answer<R> for F

A closure answers samples only.

Source§

impl<R> Answer<R> for StandIns